﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:System="clr-namespace:System;assembly=mscorlib" mc:Ignorable="d">

    <!-- Global Settings. -->
    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="Brushes.xaml" />
        <ResourceDictionary Source="Fonts.xaml" />
    </ResourceDictionary.MergedDictionaries>

    <!-- Shared Effects. -->
    <DropShadowEffect x:Key="ControlTextEffect" BlurRadius="0" Color="White" Direction="293" Opacity="0.5"
            ShadowDepth="1" />
    <DropShadowEffect x:Key="TextEffect" BlurRadius="5" Color="Black" Direction="293" Opacity="0.25" ShadowDepth="0" />
    <DropShadowEffect x:Key="ControlShadowEffect" BlurRadius="3" Color="#000000" Direction="-90" Opacity="0.55"
            ShadowDepth="1" />
    <DropShadowEffect x:Key="LightControlShadowEffect" Color="#55524f" ShadowDepth="1" BlurRadius="4" Opacity="0.5" />
    <DropShadowEffect x:Key="HeaderTextEffect" BlurRadius="0" Color="White" Direction="293" Opacity="0.5"
            ShadowDepth="1" />

    <!-- Default Font and Text Settings in UserControl. -->
    <Style TargetType="UserControl">
        <Setter Property="FontFamily" Value="{StaticResource DefaultFontFamily}" />
        <Setter Property="FontSize" Value="{StaticResource DefaultFontSize}" />
        <Setter Property="TextOptions.TextHintingMode" Value="Animated" />
    </Style>

    <!-- 
	  ***************************************************************************
	  Button
	  ***************************************************************************
	  -->

    <Style TargetType="Button">
        <Setter Property="Padding" Value="18,6" />
        <Setter Property="TextOptions.TextHintingMode" Value="Animated" />
        <Setter Property="Foreground" Value="{StaticResource ControlForeground}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Button">
                    <Grid x:Name="Root">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualStateGroup.Transitions>
                                    <VisualTransition GeneratedDuration="0:0:0.1" />
                                    <VisualTransition To="Pressed" />
                                    <VisualTransition From="Pressed" />
                                </VisualStateGroup.Transitions>
                                <VisualState x:Name="Normal" />
                                <VisualState x:Name="MouseOver">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0" Storyboard.TargetName="PressedElement"
                                                Storyboard.TargetProperty="(FrameworkElement.Opacity)" To="0" />
                                        <DoubleAnimation Duration="0" Storyboard.TargetName="MouseOverElement"
                                                Storyboard.TargetProperty="(FrameworkElement.Opacity)" To="1" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Pressed">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0" Storyboard.TargetName="NormalElement"
                                                Storyboard.TargetProperty="(FrameworkElement.Opacity)" To="0.25" />
                                        <DoubleAnimation Duration="0" Storyboard.TargetName="PressedElement"
                                                Storyboard.TargetProperty="(FrameworkElement.Opacity)" To="1" />
                                        <DoubleAnimation Duration="0" Storyboard.TargetName="MouseOverElement"
                                                Storyboard.TargetProperty="(FrameworkElement.Opacity)" To="0" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0" Storyboard.TargetName="NormalElement"
                                                Storyboard.TargetProperty="(FrameworkElement.Opacity)" To="0" />
                                        <DoubleAnimation Duration="0" Storyboard.TargetName="DisabledElement"
                                                Storyboard.TargetProperty="(FrameworkElement.Opacity)" To="1" />
                                        <DoubleAnimation Duration="0" Storyboard.TargetName="HighlightElement"
                                                Storyboard.TargetProperty="(FrameworkElement.Opacity)" To="0.5" />
                                        <DoubleAnimation Duration="0" Storyboard.TargetName="ContentHost"
                                                Storyboard.TargetProperty="(FrameworkElement.Opacity)" To="0.75" />
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="FocusStates">
                                <VisualState x:Name="Focused">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0" Storyboard.TargetName="FocusVisualElement"
                                                Storyboard.TargetProperty="(FrameworkElement.Opacity)" To="1" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Unfocused" />
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Border x:Name="DisabledElement" Background="{StaticResource DisabledBrush}" CornerRadius="2"
                                Opacity="0">
                            <Border BorderBrush="{StaticResource DisabledBorderBrush}" BorderThickness="0,0,1,1"
                                    CornerRadius="2" />
                        </Border>
                        <Border x:Name="NormalElement" Background="{StaticResource ControlBackgroundNormal}"
                                CornerRadius="2" Effect="{StaticResource ControlShadowEffect}" />
                        <Border x:Name="MouseOverElement" Background="{StaticResource ControlBackgroundOver}"
                                CornerRadius="2" Opacity="0" />
                        <Border x:Name="PressedElement" Background="{StaticResource ControlBackgroundPressed}"
                                CornerRadius="2" Opacity="0" />
                        <Border x:Name="HighlightElement" BorderBrush="{StaticResource ControlHighlight}"
                                BorderThickness="1,1,0,0" CornerRadius="2" />
                        <ContentPresenter x:Name="ContentHost"
                                HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                Margin="{TemplateBinding Padding}"
                                VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
                            <ContentPresenter.Effect>
                                <DropShadowEffect Color="{StaticResource ColorForegroundShadowColor}" Direction="-90"
                                        BlurRadius="1" ShadowDepth="1" Opacity="0.5" />
                            </ContentPresenter.Effect>
                        </ContentPresenter>
                        <Rectangle x:Name="FocusVisualElement" IsHitTestVisible="False" Margin="1" Opacity="0"
                                RadiusX="1" RadiusY="1" Stroke="{StaticResource FocusVisualBrush}"
                                StrokeThickness="{StaticResource FocusVisualStrokeThickness}" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- 
	***************************************************************************
	GreenButton
	***************************************************************************
	-->

    <Style x:Key="GreenButton" TargetType="Button">
        <Setter Property="Padding" Value="18,6" />
        <Setter Property="Foreground" Value="{StaticResource ControlForegroundGreen}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Button">
                    <Grid x:Name="Root">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualStateGroup.Transitions>
                                    <VisualTransition GeneratedDuration="0:0:0.1" />
                                    <VisualTransition To="Pressed" />
                                    <VisualTransition From="Pressed" />
                                </VisualStateGroup.Transitions>
                                <VisualState x:Name="Normal" />
                                <VisualState x:Name="MouseOver">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0" Storyboard.TargetName="PressedElement"
                                                Storyboard.TargetProperty="(FrameworkElement.Opacity)" To="0" />
                                        <DoubleAnimation Duration="0" Storyboard.TargetName="MouseOverElement"
                                                Storyboard.TargetProperty="(FrameworkElement.Opacity)" To="1" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Pressed">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0" Storyboard.TargetName="NormalElement"
                                                Storyboard.TargetProperty="(FrameworkElement.Opacity)" To="0.25" />
                                        <DoubleAnimation Duration="0" Storyboard.TargetName="PressedElement"
                                                Storyboard.TargetProperty="(FrameworkElement.Opacity)" To="1" />
                                        <DoubleAnimation Duration="0" Storyboard.TargetName="MouseOverElement"
                                                Storyboard.TargetProperty="(FrameworkElement.Opacity)" To="0" />
                                        <DoubleAnimation Duration="0" Storyboard.TargetName="HighlightElement"
                                                Storyboard.TargetProperty="(FrameworkElement.Opacity)" To="0.5" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0" Storyboard.TargetName="NormalElement"
                                                Storyboard.TargetProperty="(FrameworkElement.Opacity)" To="0" />
                                        <DoubleAnimation Duration="0" Storyboard.TargetName="DisabledElement"
                                                Storyboard.TargetProperty="(FrameworkElement.Opacity)" To="1" />
                                        <DoubleAnimation Duration="0" Storyboard.TargetName="HighlightElement"
                                                Storyboard.TargetProperty="(FrameworkElement.Opacity)" To="0.5" />
                                        <DoubleAnimation Duration="0" Storyboard.TargetName="ContentHost"
                                                Storyboard.TargetProperty="(FrameworkElement.Opacity)" To="0.65" />
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="FocusStates">
                                <VisualState x:Name="Focused">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0" Storyboard.TargetName="FocusVisualElement"
                                                Storyboard.TargetProperty="(FrameworkElement.Opacity)" To="1" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Unfocused" />
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Border x:Name="DisabledElement" Background="{StaticResource DisabledBrush}" CornerRadius="2"
                                Opacity="0">
                            <Border BorderBrush="{StaticResource DisabledBorderBrush}" BorderThickness="0,0,1,1"
                                    CornerRadius="2" />
                        </Border>
                        <Border x:Name="NormalElement" Background="{StaticResource ControlBackgroundNormal}"
                                CornerRadius="2" Effect="{StaticResource ControlShadowEffect}" />
                        <Border x:Name="MouseOverElement" Background="{StaticResource ControlBackgroundOverGreen}"
                                CornerRadius="2" Opacity="0" />
                        <Border x:Name="PressedElement" Background="{StaticResource ControlBackgroundPressedGreen}"
                                CornerRadius="2" Opacity="0" />
                        <Border x:Name="HighlightElement" BorderBrush="{StaticResource HighlightBrushGreen}"
                                BorderThickness="0.5,1,0,0" CornerRadius="2" />
                        <ContentPresenter x:Name="ContentHost"
                                HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                Margin="{TemplateBinding Padding}"
                                VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
                            <ContentPresenter.Effect>
                                <DropShadowEffect Color="{StaticResource ColorForegroundShadowColorGreen}"
                                        Direction="90" BlurRadius="1" ShadowDepth="1" Opacity="0.5" />
                            </ContentPresenter.Effect>
                        </ContentPresenter>
                        <Rectangle x:Name="FocusVisualElement" IsHitTestVisible="False" Margin="1" Opacity="0"
                                RadiusX="1" RadiusY="1" Stroke="{StaticResource FocusVisualBrush}"
                                StrokeThickness="{StaticResource FocusVisualStrokeThickness}" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- 
	***************************************************************************
	OrangeButton
	***************************************************************************
	-->

    <Style x:Key="OrangeButton" TargetType="Button">
        <Setter Property="Padding" Value="18,6" />
        <Setter Property="TextOptions.TextHintingMode" Value="Fixed" />
        <Setter Property="Foreground" Value="{StaticResource ControlForegroundOrange}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Button">
                    <Grid x:Name="Root">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualStateGroup.Transitions>
                                    <VisualTransition GeneratedDuration="0:0:0.1" />
                                    <VisualTransition To="Pressed" />
                                    <VisualTransition From="Pressed" />
                                </VisualStateGroup.Transitions>
                                <VisualState x:Name="Normal" />
                                <VisualState x:Name="MouseOver">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0" Storyboard.TargetName="PressedElement"
                                                Storyboard.TargetProperty="(FrameworkElement.Opacity)" To="0" />
                                        <DoubleAnimation Duration="0" Storyboard.TargetName="MouseOverElement"
                                                Storyboard.TargetProperty="(FrameworkElement.Opacity)" To="1" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Pressed">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0" Storyboard.TargetName="NormalElement"
                                                Storyboard.TargetProperty="(FrameworkElement.Opacity)" To="0.25" />
                                        <DoubleAnimation Duration="0" Storyboard.TargetName="PressedElement"
                                                Storyboard.TargetProperty="(FrameworkElement.Opacity)" To="1" />
                                        <DoubleAnimation Duration="0" Storyboard.TargetName="MouseOverElement"
                                                Storyboard.TargetProperty="(FrameworkElement.Opacity)" To="0" />
                                        <DoubleAnimation Duration="0" Storyboard.TargetName="HighlightElement"
                                                Storyboard.TargetProperty="(FrameworkElement.Opacity)" To="0.5" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0" Storyboard.TargetName="NormalElement"
                                                Storyboard.TargetProperty="(FrameworkElement.Opacity)" To="0" />
                                        <DoubleAnimation Duration="0" Storyboard.TargetName="DisabledElement"
                                                Storyboard.TargetProperty="(FrameworkElement.Opacity)" To="1" />
                                        <DoubleAnimation Duration="0" Storyboard.TargetName="HighlightElement"
                                                Storyboard.TargetProperty="(FrameworkElement.Opacity)" To="0.5" />
                                        <DoubleAnimation Duration="0" Storyboard.TargetName="ContentHost"
                                                Storyboard.TargetProperty="(FrameworkElement.Opacity)" To="0.65" />
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="FocusStates">
                                <VisualState x:Name="Focused">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0" Storyboard.TargetName="FocusVisualElement"
                                                Storyboard.TargetProperty="(FrameworkElement.Opacity)" To="1" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Unfocused" />
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Border x:Name="DisabledElement" Background="{StaticResource DisabledBrush}" CornerRadius="2"
                                Opacity="0">
                            <Border BorderBrush="{StaticResource DisabledBorderBrush}" BorderThickness="0,0,1,1"
                                    CornerRadius="2" />
                        </Border>
                        <Border x:Name="NormalElement" Background="{StaticResource ControlBackgroundNormalOrange}"
                                CornerRadius="2" Effect="{StaticResource ControlShadowEffect}" />
                        <Border x:Name="MouseOverElement" Background="{StaticResource ControlBackgroundOverOrange}"
                                CornerRadius="2" Opacity="0" />
                        <Border x:Name="PressedElement" Background="{StaticResource ControlBackgroundPressedOrange}"
                                CornerRadius="2" Opacity="0" />
                        <Border x:Name="HighlightElement" BorderBrush="{StaticResource HighlightBrushOrange}"
                                BorderThickness="0.5,1,0,0" CornerRadius="2" />
                        <ContentPresenter x:Name="ContentHost"
                                HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                Margin="{TemplateBinding Padding}"
                                VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
                            <ContentPresenter.Effect>
                                <DropShadowEffect Color="{StaticResource ColorForegroundShadowColorOrange}"
                                        Direction="90" BlurRadius="1" ShadowDepth="1" Opacity="0.5" />
                            </ContentPresenter.Effect>
                        </ContentPresenter>
                        <Rectangle x:Name="FocusVisualElement" IsHitTestVisible="False" Margin="1" Opacity="0"
                                RadiusX="1" RadiusY="1" Stroke="{StaticResource FocusVisualBrush}"
                                StrokeThickness="{StaticResource FocusVisualStrokeThickness}" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- 
	***************************************************************************
	BlueButton
	***************************************************************************
	-->

    <Style x:Key="BlueButton" TargetType="Button">
        <Setter Property="Padding" Value="18,6" />
        <Setter Property="TextOptions.TextHintingMode" Value="Fixed" />
        <Setter Property="Foreground" Value="{StaticResource ControlForegroundBlue}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Button">
                    <Grid x:Name="Root">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualStateGroup.Transitions>
                                    <VisualTransition GeneratedDuration="0:0:0.1" />
                                    <VisualTransition To="Pressed" />
                                    <VisualTransition From="Pressed" />
                                </VisualStateGroup.Transitions>
                                <VisualState x:Name="Normal" />
                                <VisualState x:Name="MouseOver">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0" Storyboard.TargetName="PressedElement"
                                                Storyboard.TargetProperty="(FrameworkElement.Opacity)" To="0" />
                                        <DoubleAnimation Duration="0" Storyboard.TargetName="MouseOverElement"
                                                Storyboard.TargetProperty="(FrameworkElement.Opacity)" To="1" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Pressed">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0" Storyboard.TargetName="NormalElement"
                                                Storyboard.TargetProperty="(FrameworkElement.Opacity)" To="0.25" />
                                        <DoubleAnimation Duration="0" Storyboard.TargetName="PressedElement"
                                                Storyboard.TargetProperty="(FrameworkElement.Opacity)" To="1" />
                                        <DoubleAnimation Duration="0" Storyboard.TargetName="MouseOverElement"
                                                Storyboard.TargetProperty="(FrameworkElement.Opacity)" To="0" />
                                        <DoubleAnimation Duration="0" Storyboard.TargetName="HighlightElement"
                                                Storyboard.TargetProperty="(FrameworkElement.Opacity)" To="0.5" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0" Storyboard.TargetName="NormalElement"
                                                Storyboard.TargetProperty="(FrameworkElement.Opacity)" To="0" />
                                        <DoubleAnimation Duration="0" Storyboard.TargetName="DisabledElement"
                                                Storyboard.TargetProperty="(FrameworkElement.Opacity)" To="1" />
                                        <DoubleAnimation Duration="0" Storyboard.TargetName="HighlightElement"
                                                Storyboard.TargetProperty="(FrameworkElement.Opacity)" To="0.5" />
                                        <DoubleAnimation Duration="0" Storyboard.TargetName="ContentHost"
                                                Storyboard.TargetProperty="(FrameworkElement.Opacity)" To="0.65" />
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="FocusStates">
                                <VisualState x:Name="Focused">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0" Storyboard.TargetName="FocusVisualElement"
                                                Storyboard.TargetProperty="(FrameworkElement.Opacity)" To="1" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Unfocused" />
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Border x:Name="DisabledElement" Background="{StaticResource DisabledBrush}" CornerRadius="2"
                                Opacity="0">
                            <Border BorderBrush="{StaticResource DisabledBorderBrush}" BorderThickness="0,0,1,1"
                                    CornerRadius="2" />
                        </Border>
                        <Border x:Name="NormalElement" Background="{StaticResource ControlBackgroundNormalBlue}"
                                CornerRadius="2" Effect="{StaticResource ControlShadowEffect}" />
                        <Border x:Name="MouseOverElement" Background="{StaticResource ControlBackgroundOverBlue}"
                                CornerRadius="2" Opacity="0" />
                        <Border x:Name="PressedElement" Background="{StaticResource ControlBackgroundPressedBlue}"
                                CornerRadius="2" Opacity="0" />
                        <Border x:Name="HighlightElement" BorderBrush="{StaticResource HighlightBrushBlue}"
                                BorderThickness="0.5,1,0,0" CornerRadius="2" />
                        <ContentPresenter x:Name="ContentHost"
                                HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                Margin="{TemplateBinding Padding}"
                                VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
                            <ContentPresenter.Effect>
                                <DropShadowEffect Color="{StaticResource ColorForegroundShadowColorBlue}" Direction="90"
                                        BlurRadius="1" ShadowDepth="1" Opacity="0.5" />
                            </ContentPresenter.Effect>
                        </ContentPresenter>
                        <Rectangle x:Name="FocusVisualElement" IsHitTestVisible="False" Margin="1" Opacity="0"
                                RadiusX="1" RadiusY="1" Stroke="{StaticResource FocusVisualBrush}"
                                StrokeThickness="{StaticResource FocusVisualStrokeThickness}" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- 
	***************************************************************************
	RepeatButton
	***************************************************************************
	-->

    <Style TargetType="RepeatButton">
        <Setter Property="Padding" Value="18,6" />
        <Setter Property="TextOptions.TextHintingMode" Value="Animated" />
        <Setter Property="Foreground" Value="{StaticResource ControlForeground}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="RepeatButton">
                    <Grid x:Name="Root">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualStateGroup.Transitions>
                                    <VisualTransition GeneratedDuration="0:0:0.1" />
                                    <VisualTransition To="Pressed" />
                                    <VisualTransition From="Pressed" />
                                </VisualStateGroup.Transitions>
                                <VisualState x:Name="Normal" />
                                <VisualState x:Name="MouseOver">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0" Storyboard.TargetName="PressedElement"
                                                Storyboard.TargetProperty="(FrameworkElement.Opacity)" To="0" />
                                        <DoubleAnimation Duration="0" Storyboard.TargetName="MouseOverElement"
                                                Storyboard.TargetProperty="(FrameworkElement.Opacity)" To="1" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Pressed">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0" Storyboard.TargetName="NormalElement"
                                                Storyboard.TargetProperty="(FrameworkElement.Opacity)" To="0.25" />
                                        <DoubleAnimation Duration="0" Storyboard.TargetName="PressedElement"
                                                Storyboard.TargetProperty="(FrameworkElement.Opacity)" To="1" />
                                        <DoubleAnimation Duration="0" Storyboard.TargetName="MouseOverElement"
                                                Storyboard.TargetProperty="(FrameworkElement.Opacity)" To="0" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0" Storyboard.TargetName="NormalElement"
                                                Storyboard.TargetProperty="(FrameworkElement.Opacity)" To="0" />
                                        <DoubleAnimation Duration="0" Storyboard.TargetName="DisabledElement"
                                                Storyboard.TargetProperty="(FrameworkElement.Opacity)" To="1" />
                                        <DoubleAnimation Duration="0" Storyboard.TargetName="HighlightElement"
                                                Storyboard.TargetProperty="(FrameworkElement.Opacity)" To="0.5" />
                                        <DoubleAnimation Duration="0" Storyboard.TargetName="ContentHost"
                                                Storyboard.TargetProperty="(FrameworkElement.Opacity)" To="0.75" />
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="FocusStates">
                                <VisualState x:Name="Focused">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0" Storyboard.TargetName="FocusVisualElement"
                                                Storyboard.TargetProperty="(FrameworkElement.Opacity)" To="1" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Unfocused" />
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Border x:Name="DisabledElement" Background="{StaticResource DisabledBrush}" CornerRadius="2"
                                Opacity="0">
                            <Border BorderBrush="{StaticResource DisabledBorderBrush}" BorderThickness="0,0,1,1"
                                    CornerRadius="2" />
                        </Border>
                        <Border x:Name="NormalElement" Background="{StaticResource ControlBackgroundNormal}"
                                CornerRadius="2" Effect="{StaticResource ControlShadowEffect}" />
                        <Border x:Name="MouseOverElement" Background="{StaticResource ControlBackgroundOver}"
                                CornerRadius="2" Opacity="0" />
                        <Border x:Name="PressedElement" Background="{StaticResource ControlBackgroundPressed}"
                                CornerRadius="2" Opacity="0" />
                        <Border x:Name="HighlightElement" BorderBrush="{StaticResource ControlHighlight}"
                                BorderThickness="1,1,0,0" CornerRadius="2" />
                        <ContentPresenter x:Name="ContentHost"
                                HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                Margin="{TemplateBinding Padding}"
                                VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
                            <ContentPresenter.Effect>
                                <DropShadowEffect Color="{StaticResource ColorForegroundShadowColor}" Direction="-90"
                                        BlurRadius="1" ShadowDepth="1" Opacity="0.5" />
                            </ContentPresenter.Effect>
                        </ContentPresenter>
                        <Rectangle x:Name="FocusVisualElement" IsHitTestVisible="False" Margin="1" Opacity="0"
                                RadiusX="1" RadiusY="1" Stroke="{StaticResource FocusVisualBrush}"
                                StrokeThickness="{StaticResource FocusVisualStrokeThickness}" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- 
    ***************************************************************************
    ToggleButton
    ***************************************************************************
    -->

    <Style TargetType="ToggleButton">
        <Setter Property="Padding" Value="18,6" />
        <Setter Property="TextOptions.TextHintingMode" Value="Animated" />
        <Setter Property="Foreground" Value="{StaticResource ControlForeground}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ToggleButton">
                    <Grid x:Name="Root">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualStateGroup.Transitions>
                                    <VisualTransition GeneratedDuration="0:0:0.1" />
                                    <VisualTransition To="Pressed" />
                                    <VisualTransition From="Pressed" />
                                </VisualStateGroup.Transitions>
                                <VisualState x:Name="Normal" />
                                <VisualState x:Name="MouseOver">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0" Storyboard.TargetName="MouseOverElement"
                                                Storyboard.TargetProperty="(FrameworkElement.Opacity)" To="1" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0" Storyboard.TargetName="NormalElement"
                                                Storyboard.TargetProperty="(FrameworkElement.Opacity)" To="0" />
                                        <DoubleAnimation Duration="0" Storyboard.TargetName="DisabledElement"
                                                Storyboard.TargetProperty="(FrameworkElement.Opacity)" To="1" />
                                        <DoubleAnimation Duration="0" Storyboard.TargetName="HighlightElement"
                                                Storyboard.TargetProperty="(FrameworkElement.Opacity)" To="0.5" />
                                        <DoubleAnimation Duration="0" Storyboard.TargetName="ContentHost"
                                                Storyboard.TargetProperty="(FrameworkElement.Opacity)" To="0.75" />
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="CheckStates">
                                <VisualState x:Name="Checked">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0" To="0"
                                                Storyboard.TargetProperty="(UIElement.Opacity)"
                                                Storyboard.TargetName="NormalElement" />
                                        <DoubleAnimation Duration="0" To="0"
                                                Storyboard.TargetProperty="(UIElement.Opacity)"
                                                Storyboard.TargetName="HighlightElement" />
                                        <DoubleAnimation Duration="0" To="1"
                                                Storyboard.TargetProperty="(UIElement.Opacity)"
                                                Storyboard.TargetName="CheckedElement" />
                                        <!--      <ObjectAnimationUsingKeyFrames
                                                Storyboard.TargetProperty="(UIElement.Visibility)"
                                                Storyboard.TargetName="MouseOverElement">
                      <DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Collapsed}" />
                                        </ObjectAnimationUsingKeyFrames>-->
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Unchecked" />
                                <VisualState x:Name="Indeterminate" />
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="FocusStates">
                                <VisualState x:Name="Focused">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0" Storyboard.TargetName="FocusVisualElement"
                                                Storyboard.TargetProperty="(FrameworkElement.Opacity)" To="1" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Unfocused" />
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Border x:Name="DisabledElement" Background="{StaticResource DisabledBrush}" CornerRadius="2"
                                Opacity="0">
                            <Border BorderBrush="{StaticResource DisabledBorderBrush}" BorderThickness="0,0,1,1"
                                    CornerRadius="2" />
                        </Border>
                        <Border x:Name="NormalElement" Background="{StaticResource ControlBackgroundNormal}"
                                CornerRadius="2" Effect="{StaticResource ControlShadowEffect}" />
                        <Border x:Name="CheckedElement" CornerRadius="2.5" BorderBrush="#D0494a4d" BorderThickness="1"
                                Margin="0,-1,0,-1" Opacity="0">
                            <Border.Background>
                                <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                                    <GradientStop Offset="0.1" Color="#FFE6E6E6" />
                                    <GradientStop Offset="0.9" Color="#FFC9C9C9" />
                                </LinearGradientBrush>
                            </Border.Background>
                            <Border BorderBrush="#70303030" BorderThickness="1,1,0,0" CornerRadius="2">
                                <Border BorderBrush="#30303030" BorderThickness="1" CornerRadius="1.5">
                                    <Border BorderBrush="#10303030" BorderThickness="1,1,0,0" CornerRadius="1" />
                                </Border>
                            </Border>
                        </Border>
                        <Border x:Name="MouseOverElement" Background="{StaticResource ControlBackgroundOver}"
                                CornerRadius="2" Opacity="0" />
                        <Border x:Name="HighlightElement" BorderBrush="{StaticResource ControlHighlight}"
                                BorderThickness="1,1,0,0" CornerRadius="2" />
                        <ContentPresenter x:Name="ContentHost"
                                HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                Margin="{TemplateBinding Padding}"
                                VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
                            <ContentPresenter.Effect>
                                <DropShadowEffect Color="{StaticResource ColorForegroundShadowColor}" Direction="-90"
                                        BlurRadius="1" ShadowDepth="1" Opacity="0.5" />
                            </ContentPresenter.Effect>
                        </ContentPresenter>
                        <Rectangle x:Name="FocusVisualElement" IsHitTestVisible="False" Margin="1" Opacity="0"
                                RadiusX="1" RadiusY="1" Stroke="{StaticResource FocusVisualBrush}"
                                StrokeThickness="{StaticResource FocusVisualStrokeThickness}" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- 
    ***************************************************************************
    ToolTip
    ***************************************************************************
    -->

    <!-- TODO -->
    <Style TargetType="ToolTip">
        <Setter Property="Background" Value="{StaticResource ControlBackgroundNormal}" />
        <Setter Property="FontFamily" Value="{StaticResource ContentFontFamily}" />
        <Setter Property="FontSize" Value="{StaticResource NormalFontSize}" />
        <Setter Property="Foreground" Value="{StaticResource InputSelectionForegroundBrush}" />
        <Setter Property="HorizontalContentAlignment" Value="Left" />
        <Setter Property="Padding" Value="6" />
        <Setter Property="VerticalContentAlignment" Value="Top" />
        <Setter Property="Effect">
            <Setter.Value>
                <DropShadowEffect BlurRadius="2" Direction="293" Opacity="0.24" ShadowDepth="1" />
            </Setter.Value>
        </Setter>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ToolTip">
                    <Grid x:Name="LayoutRoot">
                        <Border x:Name="Background" Background="{TemplateBinding Background}" CornerRadius="3">
                            <Border.Effect>
                                <DropShadowEffect BlurRadius="3" Direction="0" Opacity="0.1" ShadowDepth="0" />
                            </Border.Effect>
                        </Border>
                        <Border x:Name="TopBorder" BorderBrush="{StaticResource HighlightBrushGreen}"
                                BorderThickness="0,1,0,0" CornerRadius="3" />
                        <Border x:Name="LeftBorder" BorderThickness="1,0,0,0" CornerRadius="3">
                            <Border.BorderBrush>
                                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                    <GradientStop Color="#FFBAD700" Offset="0" />
                                    <GradientStop Color="#FF94AD00" Offset="1" />
                                </LinearGradientBrush>
                            </Border.BorderBrush>
                        </Border>
                        <Border x:Name="Gradient" Background="{StaticResource OverlayBrush}" CornerRadius="2"
                                Margin="1,1,0,0" />
                        <ContentPresenter x:Name="contentPresenter" Content="{TemplateBinding Content}"
                                ContentTemplate="{TemplateBinding ContentTemplate}" Effect="{StaticResource TextEffect}"
                                HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                Margin="{TemplateBinding Padding}"
                                VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- Validation ToolTip Template. -->
    <ControlTemplate x:Key="ValidationToolTipTemplate">
        <Grid x:Name="Root" Margin="5,0" Opacity="0" RenderTransformOrigin="0,0">
            <Grid.RenderTransform>
                <TranslateTransform x:Name="xform" X="-25" />
            </Grid.RenderTransform>
            <VisualStateManager.VisualStateGroups>
                <VisualStateGroup x:Name="OpenStates">
                    <VisualStateGroup.Transitions>
                        <VisualTransition GeneratedDuration="0" />
                        <VisualTransition GeneratedDuration="0:0:0.2" To="Open">
                            <Storyboard>
                                <DoubleAnimation Duration="0:0:0.2" To="0" Storyboard.TargetProperty="X"
                                        Storyboard.TargetName="xform">
                                    <DoubleAnimation.EasingFunction>
                                        <BackEase Amplitude=".3" EasingMode="EaseOut" />
                                    </DoubleAnimation.EasingFunction>
                                </DoubleAnimation>
                                <DoubleAnimation Duration="0:0:0.2" To="1" Storyboard.TargetProperty="Opacity"
                                        Storyboard.TargetName="Root" />
                            </Storyboard>
                        </VisualTransition>
                    </VisualStateGroup.Transitions>
                    <VisualState x:Name="Closed">
                        <Storyboard>
                            <DoubleAnimation Duration="0" To="0" Storyboard.TargetProperty="Opacity"
                                    Storyboard.TargetName="Root" />
                        </Storyboard>
                    </VisualState>
                    <VisualState x:Name="Open">
                        <Storyboard>
                            <DoubleAnimation Duration="0" To="0" Storyboard.TargetProperty="X"
                                    Storyboard.TargetName="xform" />
                            <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity"
                                    Storyboard.TargetName="Root" />
                        </Storyboard>
                    </VisualState>
                </VisualStateGroup>
            </VisualStateManager.VisualStateGroups>
            <Border Background="#052A2E31" CornerRadius="5" Margin="4,4,-4,-4" />
            <Border Background="#152A2E31" CornerRadius="4" Margin="3,3,-3,-3" />
            <Border Background="#252A2E31" CornerRadius="3" Margin="2,2,-2,-2" />
            <Border Background="#352A2E31" CornerRadius="2" Margin="1,1,-1,-1" />
            <Border Background="#FFDC000C" CornerRadius="2" />
            <Border CornerRadius="2">
                <TextBlock Foreground="White" MaxWidth="250" Margin="8,4,8,4" TextWrapping="Wrap"
                        Text="{Binding (Validation.Errors)[0].ErrorContent}" UseLayoutRounding="false" />
            </Border>
        </Grid>
    </ControlTemplate>

    <!-- 
	***************************************************************************
	TextBox
	***************************************************************************
	-->

    <Style TargetType="TextBox">
        <Setter Property="Background" Value="{StaticResource InputBackgroundBrush}" />
        <Setter Property="BorderBrush" Value="{StaticResource ControlBorderBrush}" />
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="Foreground" Value="{StaticResource InputForegroundBrush}" />
        <Setter Property="Padding" Value="5,4,5,4" />
        <Setter Property="SelectionBrush" Value="{StaticResource InputSelectionBrush}" />
        <!--<Setter Property="SelectionForeground" Value="{StaticResource InputSelectionForegroundBrush}" />-->
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="TextBox">

                    <Grid x:Name="RootElement">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal" />
                                <VisualState x:Name="MouseOver" />
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0" To="0.55" Storyboard.TargetProperty="Opacity"
                                                Storyboard.TargetName="DisabledVisualElement" />
                                        <DoubleAnimation Duration="0" To="0.5"
                                                Storyboard.TargetProperty="(UIElement.Opacity)"
                                                Storyboard.TargetName="PART_ContentHost" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="ReadOnly">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0" To="0.55" Storyboard.TargetProperty="Opacity"
                                                Storyboard.TargetName="ReadOnlyVisualElement" />
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="FocusStates">
                                <VisualState x:Name="Focused">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0" Storyboard.TargetName="FocusVisualElement"
                                                Storyboard.TargetProperty="(FrameworkElement.Opacity)" To="1" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Unfocused" />
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="ValidationStates">
                                <VisualState x:Name="Valid" />
                                <VisualState x:Name="InvalidUnfocused">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility"
                                                Storyboard.TargetName="ValidationErrorElement">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Visible}" />
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="InvalidFocused">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility"
                                                Storyboard.TargetName="ValidationErrorElement">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Visible}" />
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="IsOpen"
                                                Storyboard.TargetName="validationTooltip">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <System:Boolean>True</System:Boolean>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Border x:Name="Border" Background="{TemplateBinding Background}"
                                BorderBrush="{TemplateBinding BorderBrush}"
                                BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="2.5" Opacity="1">
                            <Grid>
                                <Border x:Name="ReadOnlyVisualElement" Background="{StaticResource ReadOnlyBrush}"
                                        CornerRadius="2" Opacity="0" />
                                <ScrollViewer x:Name="PART_ContentHost" Foreground="{TemplateBinding Foreground}"
                                        BorderThickness="0" IsTabStop="False" Margin="1"
                                        Padding="{TemplateBinding Padding}" />
                            </Grid>
                        </Border>
                        <Border x:Name="OuterHighlight" BorderBrush="{StaticResource ControlOuterHighlightBrush}"
                                BorderThickness="0,0,1,1" CornerRadius="3" Margin="0,0,-1,-1" />
                        <Border x:Name="InnerShadowDark" BorderBrush="{StaticResource InnerShadowDarkBrush}"
                                BorderThickness="1,1,0,0" CornerRadius="2" Margin="1" />
                        <Border x:Name="InnerShadowLight" BorderBrush="{StaticResource InnerShadowLightBrush}"
                                BorderThickness="1,1,0,0" CornerRadius="1" Margin="2" />
                        <Border x:Name="DisabledVisualElement" Background="{StaticResource DisabledBrush}"
                                IsHitTestVisible="False" Margin="1" Opacity="0" CornerRadius="2" />
                        <Rectangle x:Name="FocusVisualElement" IsHitTestVisible="False" Margin="2" Opacity="0"
                                RadiusX="1" RadiusY="1" Stroke="{StaticResource FocusVisualBrush}"
                                StrokeThickness="{StaticResource FocusVisualStrokeThickness}" />
                        <Border x:Name="ValidationErrorElement" BorderBrush="{StaticResource ErrorBrush}"
                                BorderThickness="1" CornerRadius="3" Visibility="Collapsed">
                            <ToolTipService.ToolTip>
                                <ToolTip x:Name="validationTooltip"
                                        DataContext="{Binding RelativeSource={RelativeSource TemplatedParent}}"
                                        Placement="Right"
                                        PlacementTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}"
                                        Template="{StaticResource ValidationToolTipTemplate}">
                                    <ToolTip.Triggers>
                                        <EventTrigger RoutedEvent="Canvas.Loaded">
                                            <BeginStoryboard>
                                                <Storyboard>
                                                    <ObjectAnimationUsingKeyFrames
                                                            Storyboard.TargetProperty="IsHitTestVisible"
                                                            Storyboard.TargetName="validationTooltip">
                                                        <DiscreteObjectKeyFrame KeyTime="0" Value="True" />
                                                    </ObjectAnimationUsingKeyFrames>
                                                </Storyboard>
                                            </BeginStoryboard>
                                        </EventTrigger>
                                    </ToolTip.Triggers>
                                </ToolTip>
                            </ToolTipService.ToolTip>
                            <Grid Background="Transparent" HorizontalAlignment="Right" Height="12" Margin="1,-4,-4,0"
                                    VerticalAlignment="Top" Width="12">
                                <Path Data="M 1,0 L6,0 A 2,2 90 0 1 8,2 L8,7 z" Fill="{StaticResource ErrorBrush}"
                                        Margin="1,3,0,0" />
                            </Grid>
                        </Border>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- 
	***************************************************************************
	PasswordBox
	***************************************************************************
	-->

    <Style TargetType="PasswordBox">
        <Setter Property="Background" Value="{StaticResource InputBackgroundBrush}" />
        <Setter Property="BorderBrush" Value="{StaticResource ControlBorderBrush}" />
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="Foreground" Value="{StaticResource InputForegroundBrush}" />
        <Setter Property="Padding" Value="5,4,5,4" />
        <Setter Property="SelectionBrush" Value="{StaticResource InputSelectionBrush}" />
        <!--<Setter Property="SelectionBackground" Value="{StaticResource InputSelectionBrush}" />-->
        <!--<Setter Property="SelectionForeground" Value="{StaticResource InputSelectionForegroundBrush}" />-->
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="PasswordBox">
                    <Grid x:Name="RootElement">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal" />
                                <VisualState x:Name="MouseOver" />
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0" To="0.55" Storyboard.TargetProperty="Opacity"
                                                Storyboard.TargetName="DisabledVisualElement" />
                                        <DoubleAnimation Duration="0" To="0.5"
                                                Storyboard.TargetProperty="(UIElement.Opacity)"
                                                Storyboard.TargetName="PART_ContentHost" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="ReadOnly">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0" To="0.55" Storyboard.TargetProperty="Opacity"
                                                Storyboard.TargetName="ReadOnlyVisualElement" />
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="FocusStates">
                                <VisualState x:Name="Focused">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0" Storyboard.TargetName="FocusVisualElement"
                                                Storyboard.TargetProperty="(FrameworkElement.Opacity)" To="1" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Unfocused" />
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="ValidationStates">
                                <VisualState x:Name="Valid" />
                                <VisualState x:Name="InvalidUnfocused">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility"
                                                Storyboard.TargetName="ValidationErrorElement">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Visible}" />
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="InvalidFocused">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility"
                                                Storyboard.TargetName="ValidationErrorElement">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Visible}" />
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="IsOpen"
                                                Storyboard.TargetName="validationTooltip">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <System:Boolean>True</System:Boolean>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Border x:Name="Border" Background="{TemplateBinding Background}"
                                BorderBrush="{TemplateBinding BorderBrush}"
                                BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="2.5" Opacity="1">
                            <Grid>
                                <Border x:Name="ReadOnlyVisualElement" Background="{StaticResource ReadOnlyBrush}"
                                        CornerRadius="2" Opacity="0" />
                                <ScrollViewer x:Name="PART_ContentHost" Foreground="{TemplateBinding Foreground}"
                                        Padding="{TemplateBinding Padding}" />

                                <!--<Border x:Name="ContentElement" BorderThickness="0" Margin="1"
                                        Padding="{TemplateBinding Padding}" />-->
                            </Grid>
                        </Border>
                        <Border x:Name="OuterHighlight" BorderBrush="{StaticResource ControlOuterHighlightBrush}"
                                BorderThickness="0,0,1,1" CornerRadius="3" Margin="0,0,-1,-1" />
                        <Border x:Name="InnerShadowDark" BorderBrush="{StaticResource InnerShadowDarkBrush}"
                                BorderThickness="1,1,0,0" CornerRadius="2" Margin="1" />
                        <Border x:Name="InnerShadowLight" BorderBrush="{StaticResource InnerShadowLightBrush}"
                                BorderThickness="1,1,0,0" CornerRadius="1" Margin="2" />
                        <Border x:Name="DisabledVisualElement" Background="{StaticResource DisabledBrush}"
                                IsHitTestVisible="False" Margin="1" Opacity="0" CornerRadius="2" />
                        <Rectangle x:Name="FocusVisualElement" IsHitTestVisible="False" Margin="2" Opacity="0"
                                RadiusX="1" RadiusY="1" Stroke="{StaticResource FocusVisualBrush}"
                                StrokeThickness="{StaticResource FocusVisualStrokeThickness}" />
                        <Border x:Name="ValidationErrorElement" BorderBrush="{StaticResource ErrorBrush}"
                                BorderThickness="1" CornerRadius="3" Visibility="Collapsed">
                            <ToolTipService.ToolTip>
                                <ToolTip x:Name="validationTooltip"
                                        DataContext="{Binding RelativeSource={RelativeSource TemplatedParent}}"
                                        Placement="Right"
                                        PlacementTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}"
                                        Template="{StaticResource ValidationToolTipTemplate}">
                                    <ToolTip.Triggers>
                                        <EventTrigger RoutedEvent="Canvas.Loaded">
                                            <BeginStoryboard>
                                                <Storyboard>
                                                    <ObjectAnimationUsingKeyFrames
                                                            Storyboard.TargetProperty="IsHitTestVisible"
                                                            Storyboard.TargetName="validationTooltip">
                                                        <DiscreteObjectKeyFrame KeyTime="0" Value="True" />
                                                    </ObjectAnimationUsingKeyFrames>
                                                </Storyboard>
                                            </BeginStoryboard>
                                        </EventTrigger>
                                    </ToolTip.Triggers>
                                </ToolTip>
                            </ToolTipService.ToolTip>
                            <Grid Background="Transparent" HorizontalAlignment="Right" Height="12" Margin="1,-4,-4,0"
                                    VerticalAlignment="Top" Width="12">
                                <Path Data="M 1,0 L6,0 A 2,2 90 0 1 8,2 L8,7 z" Fill="{StaticResource ErrorBrush}"
                                        Margin="1,3,0,0" />
                            </Grid>
                        </Border>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- 
    ***************************************************************************
    CheckBox
    ***************************************************************************
    -->

    <Style TargetType="CheckBox">
        <Setter Property="Background" Value="{StaticResource CheckBoxBackgroundBrush}" />
        <Setter Property="BorderBrush" Value="{StaticResource CheckBoxBorderBrush}" />
        <Setter Property="Foreground" Value="{StaticResource NormalFontBrush}" />
        <Setter Property="HorizontalContentAlignment" Value="Left" />
        <Setter Property="Padding" Value="6,1,0,0" />
        <Setter Property="VerticalContentAlignment" Value="Center" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="CheckBox">
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="13" />
                            <ColumnDefinition Width="*" />
                        </Grid.ColumnDefinitions>
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal" />
                                <VisualState x:Name="MouseOver">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames
                                                Storyboard.TargetProperty="(UIElement.Visibility)"
                                                Storyboard.TargetName="MouseOverBorder">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Visible}" />
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Pressed">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames
                                                Storyboard.TargetProperty="(UIElement.Visibility)"
                                                Storyboard.TargetName="PressedBorder">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Visible}" />
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0" To=".55"
                                                Storyboard.TargetProperty="(UIElement.Opacity)"
                                                Storyboard.TargetName="contentPresenter" />
                                        <DoubleAnimation Duration="0" To="0.55"
                                                Storyboard.TargetProperty="(UIElement.Opacity)"
                                                Storyboard.TargetName="DisabledVisualElement" />
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="CheckStates">
                                <VisualState x:Name="Checked">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0" To="1"
                                                Storyboard.TargetProperty="(UIElement.Opacity)"
                                                Storyboard.TargetName="CheckIcon" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Unchecked" />
                                <VisualState x:Name="Indeterminate">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0" To="1"
                                                Storyboard.TargetProperty="(UIElement.Opacity)"
                                                Storyboard.TargetName="IndeterminateIcon" />
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="FocusStates">
                                <VisualState x:Name="Focused">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0" Storyboard.TargetName="FocusVisualElement"
                                                Storyboard.TargetProperty="(FrameworkElement.Opacity)" To="1" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Unfocused" />
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="ValidationStates">
                                <VisualState x:Name="Valid" />
                                <VisualState x:Name="InvalidUnfocused">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility"
                                                Storyboard.TargetName="ValidationErrorElement">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Visible}" />
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="InvalidFocused">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility"
                                                Storyboard.TargetName="ValidationErrorElement">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Visible}" />
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="IsOpen"
                                                Storyboard.TargetName="validationTooltip">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <System:Boolean>True</System:Boolean>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Grid Height="12" HorizontalAlignment="Left"
                                VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Width="12">
                            <Rectangle x:Name="Background" Fill="{TemplateBinding Background}" Height="12"
                                    Stroke="{TemplateBinding BorderBrush}" Width="12" />
                            <Border x:Name="OuterHighlight" BorderBrush="{StaticResource ControlOuterHighlightBrush}"
                                    BorderThickness="0,0,1,1" CornerRadius="1,0,1,0" Margin="1,1,-1,-1" />
                            <Border x:Name="InnerShadow" BorderBrush="{StaticResource CheckBoxInnerShadowBrush}"
                                    BorderThickness="1,1,0,0" CornerRadius="0.5" Margin="1,1,0,0" />
                            <Border x:Name="MouseOverBorder" BorderBrush="{StaticResource ColorAccentBrush}"
                                    BorderThickness="1" Margin="1" Visibility="Collapsed" />
                            <Border x:Name="PressedBorder" BorderBrush="{StaticResource ColorAccentSubduedBrush}"
                                    BorderThickness="1" Margin="1" Visibility="Collapsed" />
                            <Path x:Name="CheckIcon"
                                    Data="M0.5625,5.0625 L1.5,3.9375 L2.9575791,4.9549685 C2.9575791,4.9549685 5.75,1.125 5.75,1.125 C5.75,1.125 6.9375,2 6.9375,2 C6.9375,2 3.186887,7.0000076 3.186887,7.0000076 z"
                                    Fill="{StaticResource ColorAccentHighlightBrush}" FlowDirection="LeftToRight"
                                    Margin="2,2,0,1" Opacity="0" />
                            <Rectangle x:Name="IndeterminateIcon" Fill="{StaticResource ColorAccentHighlightBrush}"
                                    Height="2" Opacity="0" Width="6" />
                            <Rectangle x:Name="DisabledVisualElement" Fill="{StaticResource DisabledBrush}" Height="12"
                                    Opacity="0" Width="12" />
                            <Rectangle x:Name="FocusVisualElement" IsHitTestVisible="False" Margin="2" Opacity="0"
                                    Stroke="{StaticResource FocusVisualBrush}"
                                    StrokeThickness="{StaticResource FocusVisualStrokeThickness}" />
                            <Border x:Name="ValidationErrorElement" BorderBrush="{StaticResource ErrorBrush}"
                                    BorderThickness="1" Margin="1"
                                    ToolTipService.PlacementTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}"
                                    Visibility="Collapsed">
                                <ToolTipService.ToolTip>
                                    <ToolTip x:Name="validationTooltip"
                                            DataContext="{Binding RelativeSource={RelativeSource TemplatedParent}}"
                                            Placement="Right"
                                            PlacementTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}"
                                            Template="{StaticResource ValidationToolTipTemplate}">
                                        <ToolTip.Triggers>
                                            <EventTrigger RoutedEvent="Canvas.Loaded">
                                                <BeginStoryboard>
                                                    <Storyboard>
                                                        <ObjectAnimationUsingKeyFrames
                                                                Storyboard.TargetProperty="IsHitTestVisible"
                                                                Storyboard.TargetName="validationTooltip">
                                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                                <DiscreteObjectKeyFrame.Value>
                                                                    <System:Boolean>true</System:Boolean>
                                                                </DiscreteObjectKeyFrame.Value>
                                                            </DiscreteObjectKeyFrame>
                                                        </ObjectAnimationUsingKeyFrames>
                                                    </Storyboard>
                                                </BeginStoryboard>
                                            </EventTrigger>
                                        </ToolTip.Triggers>
                                    </ToolTip>
                                </ToolTipService.ToolTip>
                                <Grid Background="Transparent" HorizontalAlignment="Right" Height="10"
                                        Margin="0,-4,-4,0" VerticalAlignment="Top" Width="10">
                                    <Path Data="M 1,0 L5,0 A 2,2 90 0 1 7,2 L7,6 z" Fill="{StaticResource ErrorBrush}"
                                            Margin="0,3,0,0" />
                                </Grid>
                            </Border>
                        </Grid>
                        <ContentPresenter x:Name="contentPresenter" Content="{TemplateBinding Content}"
                                ContentTemplate="{TemplateBinding ContentTemplate}" Grid.Column="1"
                                HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                Margin="{TemplateBinding Padding}"
                                VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- 
    ***************************************************************************
    RadioButton
    ***************************************************************************
    -->

    <Style TargetType="RadioButton">
        <Setter Property="Background" Value="{StaticResource RadioButtonBackgroundBrush}" />
        <Setter Property="BorderBrush" Value="{StaticResource RadioButtonBorderBrush}" />
        <Setter Property="Foreground" Value="{StaticResource NormalFontBrush}" />
        <Setter Property="HorizontalContentAlignment" Value="Left" />
        <Setter Property="Padding" Value="6,1,0,0" />
        <Setter Property="VerticalContentAlignment" Value="Center" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="RadioButton">
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="13" />
                            <ColumnDefinition Width="*" />
                        </Grid.ColumnDefinitions>
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal" />
                                <VisualState x:Name="MouseOver">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames
                                                Storyboard.TargetProperty="(UIElement.Visibility)"
                                                Storyboard.TargetName="MouseOverBorder">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Visible}" />
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Pressed">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames
                                                Storyboard.TargetProperty="(UIElement.Visibility)"
                                                Storyboard.TargetName="PressedBorder">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Visible}" />
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0" To=".55"
                                                Storyboard.TargetProperty="(UIElement.Opacity)"
                                                Storyboard.TargetName="contentPresenter" />
                                        <DoubleAnimation Duration="0" To="0.55"
                                                Storyboard.TargetProperty="(UIElement.Opacity)"
                                                Storyboard.TargetName="DisabledVisualElement" />
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="CheckStates">
                                <VisualState x:Name="Checked">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0" To="1"
                                                Storyboard.TargetProperty="(UIElement.Opacity)"
                                                Storyboard.TargetName="CheckIcon" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Unchecked" />
                                <VisualState x:Name="Indeterminate">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0" To="1"
                                                Storyboard.TargetProperty="(UIElement.Opacity)"
                                                Storyboard.TargetName="IndeterminateIcon" />
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="FocusStates">
                                <VisualState x:Name="Focused">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0" Storyboard.TargetName="FocusVisualElement"
                                                Storyboard.TargetProperty="(FrameworkElement.Opacity)" To="1" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Unfocused" />
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="ValidationStates">
                                <VisualState x:Name="Valid" />
                                <VisualState x:Name="InvalidUnfocused">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility"
                                                Storyboard.TargetName="ValidationErrorElement">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Visible}" />
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="InvalidFocused">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility"
                                                Storyboard.TargetName="ValidationErrorElement">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Visible}" />
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="IsOpen"
                                                Storyboard.TargetName="validationTooltip">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <System:Boolean>True</System:Boolean>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Grid Height="12" HorizontalAlignment="Left"
                                VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Width="12">
                            <Ellipse x:Name="OuterHighlight" Stroke="#90FFFFFF" StrokeThickness="1"
                                    Margin="1,1,-0.5,-0.5" />
                            <Ellipse x:Name="Background" Fill="{TemplateBinding Background}" Height="12"
                                    Stroke="{TemplateBinding BorderBrush}"
                                    StrokeThickness="{TemplateBinding BorderThickness}" Width="12" />
                            <Ellipse Fill="{StaticResource RadioButtonInnerShadowBrush}" Margin="1" />
                            <Border x:Name="MouseOverBorder" BorderBrush="{StaticResource ColorAccentBrush}"
                                    BorderThickness="1" CornerRadius="6" Margin="1" Visibility="Collapsed" />
                            <Border x:Name="PressedBorder" BorderBrush="{StaticResource ColorAccentSubduedBrush}"
                                    BorderThickness="1" CornerRadius="6" Margin="1" Visibility="Collapsed" />
                            <Ellipse x:Name="CheckIcon" Fill="{StaticResource ColorAccentHighlightBrush}" Margin="3"
                                    Opacity="0" />
                            <Ellipse x:Name="IndeterminateIcon" Stroke="{StaticResource ColorAccentHighlightBrush}"
                                    StrokeThickness="1" Margin="3" Opacity="0" />
                            <Ellipse x:Name="DisabledVisualElement" Fill="{StaticResource DisabledBrush}" Height="12"
                                    Opacity="0" Width="12" />
                            <Ellipse x:Name="FocusVisualElement" IsHitTestVisible="False" Margin="2" Opacity="0"
                                    Stroke="{StaticResource FocusVisualBrush}"
                                    StrokeThickness="{StaticResource FocusVisualStrokeThickness}" />
                            <Grid x:Name="ValidationErrorElement"
                                    ToolTipService.PlacementTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}"
                                    Visibility="Collapsed">
                                <ToolTipService.ToolTip>
                                    <ToolTip x:Name="validationTooltip"
                                            DataContext="{Binding RelativeSource={RelativeSource TemplatedParent}}"
                                            Placement="Right"
                                            PlacementTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}"
                                            Template="{StaticResource ValidationToolTipTemplate}">
                                        <ToolTip.Triggers>
                                            <EventTrigger RoutedEvent="Canvas.Loaded">
                                                <BeginStoryboard>
                                                    <Storyboard>
                                                        <ObjectAnimationUsingKeyFrames
                                                                Storyboard.TargetProperty="IsHitTestVisible"
                                                                Storyboard.TargetName="validationTooltip">
                                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                                <DiscreteObjectKeyFrame.Value>
                                                                    <System:Boolean>true</System:Boolean>
                                                                </DiscreteObjectKeyFrame.Value>
                                                            </DiscreteObjectKeyFrame>
                                                        </ObjectAnimationUsingKeyFrames>
                                                    </Storyboard>
                                                </BeginStoryboard>
                                            </EventTrigger>
                                        </ToolTip.Triggers>
                                    </ToolTip>
                                </ToolTipService.ToolTip>
                                <Ellipse Height="12" Stroke="{StaticResource ErrorBrush}" StrokeThickness="1" Width="12" />
                                <Ellipse Fill="{StaticResource ErrorBrush}" Height="4" HorizontalAlignment="Right"
                                        Margin="0,-3,-3,0" VerticalAlignment="Top" Width="4" />
                                <Ellipse Fill="Transparent" Height="10" HorizontalAlignment="Right" Margin="0,-6,-5,0"
                                        VerticalAlignment="Top" Width="10" />
                            </Grid>
                        </Grid>
                        <ContentPresenter x:Name="contentPresenter" Content="{TemplateBinding Content}"
                                ContentTemplate="{TemplateBinding ContentTemplate}" Grid.Column="1"
                                HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                Margin="{TemplateBinding Padding}"
                                VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="HeadingBase" TargetType="TextBlock">
        <Setter Property="FontFamily" Value="{StaticResource HeadingFontFamily}" />
        <Setter Property="FontWeight" Value="Bold" />
        <Setter Property="Foreground" Value="{StaticResource NormalFontBrush}" />
    </Style>
    <Style x:Key="Heading1" BasedOn="{StaticResource HeadingBase}" TargetType="TextBlock">
        <Setter Property="FontSize" Value="{StaticResource Heading1FontSize}" />
        <Setter Property="Foreground" Value="{StaticResource Heading1FontBrush}" />
    </Style>
    <Style x:Key="Heading2" BasedOn="{StaticResource HeadingBase}" TargetType="TextBlock">
        <Setter Property="FontSize" Value="{StaticResource Heading2FontSize}" />
        <Setter Property="Foreground" Value="{StaticResource Heading2FontBrush}" />
    </Style>
    <Style x:Key="Heading3" BasedOn="{StaticResource HeadingBase}" TargetType="TextBlock">
        <Setter Property="FontSize" Value="{StaticResource Heading3FontSize}" />
        <Setter Property="Foreground" Value="{StaticResource Heading3FontBrush}" />
    </Style>
    <Style x:Key="Heading4" BasedOn="{StaticResource HeadingBase}" TargetType="TextBlock">
        <Setter Property="FontSize" Value="{StaticResource Heading4FontSize}" />
    </Style>
    <Style x:Key="Heading5" BasedOn="{StaticResource HeadingBase}" TargetType="TextBlock">
        <Setter Property="FontSize" Value="{StaticResource Heading5FontSize}" />
    </Style>
    <Style x:Key="Heading6" BasedOn="{StaticResource HeadingBase}" TargetType="TextBlock">
        <Setter Property="FontSize" Value="{StaticResource Heading6FontSize}" />
    </Style>

    <!-- 
    ***************************************************************************
    HyperlinkButton : NOT IN WPF
    ***************************************************************************
    -->

    <!--<Style TargetType="HyperlinkButton">
        <Setter Property="Background" Value="Transparent" />
        <Setter Property="Cursor" Value="Hand" />
        <Setter Property="Foreground" Value="{StaticResource ColorAccentHighlightBrush}" />
        <Setter Property="HorizontalContentAlignment" Value="Left" />
        <Setter Property="Padding" Value="2,0,2,0" />
        <Setter Property="VerticalContentAlignment" Value="Top" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="HyperlinkButton">
                    <Grid Background="{TemplateBinding Background}" Cursor="{TemplateBinding Cursor}">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal" />
                                <VisualState x:Name="MouseOver">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0" To="1.0"
                                                Storyboard.TargetProperty="(UIElement.Opacity)"
                                                Storyboard.TargetName="Underline" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Pressed" />
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <ColorAnimation Duration="0" To="#FFA0A0A0"
                                                Storyboard.TargetProperty="(Control.Foreground).(SolidColorBrush.Color)"
                                                Storyboard.TargetName="contentPresenter" d:IsOptimized="True" />
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="FocusStates">
                                <VisualState x:Name="Focused">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0" Storyboard.TargetName="FocusVisualElement"
                                                Storyboard.TargetProperty="(FrameworkElement.Opacity)" To="1" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Unfocused" />
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <StackPanel Margin="{TemplateBinding Padding}"
                                HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                VerticalAlignment="{TemplateBinding VerticalContentAlignment}" UseLayoutRounding="True">
                            <ContentControl x:Name="contentPresenter" Content="{TemplateBinding Content}"
                                    ContentTemplate="{TemplateBinding ContentTemplate}"
                                    Foreground="{TemplateBinding Foreground}" />
                            <Rectangle x:Name="Underline" Height="1" VerticalAlignment="Bottom"
                                    Fill="{TemplateBinding Foreground}" Margin="0,1,0,2" Opacity="0" />
                        </StackPanel>
                        <Rectangle x:Name="FocusVisualElement" IsHitTestVisible="False" Margin="0" Opacity="0"
                                RadiusX="2" RadiusY="2" Stroke="{StaticResource FocusVisualBrush}"
                                StrokeThickness="{StaticResource FocusVisualStrokeThickness}" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>-->

    <!-- 
    ***************************************************************************
    ProgressBar (control template separate so it can be reused)
    ***************************************************************************
    -->

    <ControlTemplate x:Key="ProgressBarTemplate" TargetType="ProgressBar">
        <Grid x:Name="Root">
            <VisualStateManager.VisualStateGroups>
                <VisualStateGroup x:Name="CommonStates">
                    <VisualState x:Name="Determinate" />
                    <VisualState x:Name="Indeterminate">
                        <Storyboard RepeatBehavior="Forever">
                            <DoubleAnimation Duration="00:00:.5" From="0" To="20"
                                    Storyboard.TargetProperty="(Shape.Fill).(LinearGradientBrush.Transform).(TransformGroup.Children)[0].X"
                                    Storyboard.TargetName="IndeterminateGradientFill" />

                            <ColorAnimation Duration="0" To="#66FFFFFF"
                                    Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[0].(GradientStop.Color)"
                                    Storyboard.TargetName="IndeterminateGradientFill" d:IsOptimized="True" />
                            <ColorAnimation Duration="0" To="#66FFFFFF"
                                    Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[2].(GradientStop.Color)"
                                    Storyboard.TargetName="IndeterminateGradientFill" d:IsOptimized="True" />
                            <ColorAnimation Duration="0" To="#66FFFFFF"
                                    Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[3].(GradientStop.Color)"
                                    Storyboard.TargetName="IndeterminateGradientFill" d:IsOptimized="True" />
                            <DoubleAnimation Duration="0" To="1"
                                    Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[2].(GradientStop.Offset)"
                                    Storyboard.TargetName="IndeterminateGradientFill" d:IsOptimized="True" />
                            <ColorAnimation Duration="0" To="Transparent"
                                    Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[1].(GradientStop.Color)"
                                    Storyboard.TargetName="IndeterminateGradientFill" d:IsOptimized="True" />
                            <DoubleAnimation Duration="0" To="0.15"
                                    Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[3].(GradientStop.Offset)"
                                    Storyboard.TargetName="IndeterminateGradientFill" d:IsOptimized="True" />
                            <DoubleAnimation Duration="0" To="0.85"
                                    Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[1].(GradientStop.Offset)"
                                    Storyboard.TargetName="IndeterminateGradientFill" d:IsOptimized="True" />
                            <DoubleAnimation Duration="0" To="0.85"
                                    Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[4].(GradientStop.Offset)"
                                    Storyboard.TargetName="IndeterminateGradientFill" d:IsOptimized="True" />
                            <ColorAnimation Duration="0" To="#66FEFEFE"
                                    Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[4].(GradientStop.Color)"
                                    Storyboard.TargetName="IndeterminateGradientFill" d:IsOptimized="True" />
                            <ColorAnimation Duration="0" To="Transparent"
                                    Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[5].(GradientStop.Color)"
                                    Storyboard.TargetName="IndeterminateGradientFill" d:IsOptimized="True" />
                            <DoubleAnimation Duration="0" To="0.15"
                                    Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[5].(GradientStop.Offset)"
                                    Storyboard.TargetName="IndeterminateGradientFill" d:IsOptimized="True" />
                            <DoubleAnimation Duration="0" To="0"
                                    Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[0].(GradientStop.Offset)"
                                    Storyboard.TargetName="IndeterminateGradientFill" d:IsOptimized="True" />
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)"
                                    Storyboard.TargetName="DeterminateRoot">
                                <DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Visible}" />
                            </ObjectAnimationUsingKeyFrames>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)"
                                    Storyboard.TargetName="IndeterminateGradientFill">
                                <DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Visible}" />
                            </ObjectAnimationUsingKeyFrames>
                        </Storyboard>
                    </VisualState>
                </VisualStateGroup>
            </VisualStateManager.VisualStateGroups>
            <Border x:Name="OuterHighlight" BorderBrush="{StaticResource ControlOuterHighlightBrush}"
                    BorderThickness="1" CornerRadius="3" Margin="0,0,-1,-1" />
            <Border x:Name="PART_Track" Background="{TemplateBinding Background}"
                    BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}"
                    CornerRadius="2" />

            <!-- Inner Shadow. -->
            <Border BorderBrush="{StaticResource InnerShadowDarkBrush}" BorderThickness="1" CornerRadius="2" />
            <Border BorderBrush="{StaticResource InnerShadowLightBrush}" BorderThickness="1" CornerRadius="1" Margin="1" />
            <Grid x:Name="ProgressBarRootGrid">
                <Grid x:Name="DeterminateRoot" Margin="1">
                    <Grid x:Name="PART_Indicator" HorizontalAlignment="Left">
                        <Rectangle Fill="{TemplateBinding Foreground}" Margin="{TemplateBinding BorderThickness}"
                                RadiusX="1" RadiusY="1" />
                        <Rectangle x:Name="Overlay" Margin="{TemplateBinding BorderThickness}" RadiusX="1" RadiusY="1"
                                Visibility="Collapsed">
                            <Rectangle.Fill>
                                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                    <GradientStop Color="#2BFFFFFF" Offset="0" />
                                    <GradientStop Color="#2B000000" Offset="1" />
                                </LinearGradientBrush>
                            </Rectangle.Fill>
                        </Rectangle>
                        <Rectangle x:Name="IndeterminateGradientFill" Margin="{TemplateBinding BorderThickness}"
                                Opacity="0.7" RadiusX="1" RadiusY="1" StrokeThickness="1" Visibility="Collapsed">
                            <Rectangle.Fill>
                                <LinearGradientBrush EndPoint="0,1" MappingMode="Absolute" SpreadMethod="Repeat"
                                        StartPoint="20,1">
                                    <LinearGradientBrush.Transform>
                                        <TransformGroup>
                                            <TranslateTransform X="0" />
                                            <SkewTransform AngleX="-45" />
                                        </TransformGroup>
                                    </LinearGradientBrush.Transform>
                                    <GradientStop Color="#FFFFFFFF" Offset="0" />
                                    <GradientStop Color="#00FFFFFF" Offset=".25" />
                                    <GradientStop Color="#FFFFFFFF" Offset="0.85" />
                                    <GradientStop Color="#25FFFFFF" Offset="0.339" />
                                    <GradientStop Color="#33FEFEFE" Offset="0.253" />
                                    <GradientStop Color="#11FFFFFF" Offset="0.545" />
                                </LinearGradientBrush>
                            </Rectangle.Fill>
                        </Rectangle>
                        <Rectangle x:Name="Highlight" Margin="{TemplateBinding BorderThickness}" RadiusX="1" RadiusY="1">
                            <Rectangle.Effect>
                                <BlurEffect Radius="2" />
                            </Rectangle.Effect>
                            <Rectangle.Fill>
                                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                    <GradientStop Color="#26FFFFFF" Offset="0" />
                                    <GradientStop Color="Transparent" Offset="1" />
                                    <GradientStop Color="#26FFFFFF" Offset="0.5" />
                                    <GradientStop Color="Transparent" Offset="0.5" />
                                </LinearGradientBrush>
                            </Rectangle.Fill>
                        </Rectangle>
                    </Grid>
                </Grid>
            </Grid>
        </Grid>
    </ControlTemplate>
    <Style TargetType="ProgressBar">
        <Setter Property="Background" Value="{StaticResource ControlBackgroundAltBrush}" />
        <Setter Property="BorderThickness" Value="0" />
        <Setter Property="Foreground" Value="{StaticResource ColorAccentBrush}" />
        <Setter Property="IsTabStop" Value="False" />
        <Setter Property="Maximum" Value="100" />
        <Setter Property="Template" Value="{StaticResource ProgressBarTemplate}" />
    </Style>

    <!-- 
    ***************************************************************************
    ListBox / ListBoxItem
    ***************************************************************************
    -->

    <Style TargetType="ListBoxItem">
        <Setter Property="Foreground" Value="{StaticResource InputForegroundBrush}" />
        <Setter Property="TextBlock.Foreground" Value="{StaticResource InputForegroundBrush}" />
        <Setter Property="Background" Value="Transparent" />
        <Setter Property="HorizontalContentAlignment" Value="Left" />
        <Setter Property="Padding" Value="6,4" />
        <Setter Property="KeyboardNavigation.ControlTabNavigation" Value="Local" />
        <Setter Property="VerticalContentAlignment" Value="Top" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ListBoxItem">
                    <Grid Background="{TemplateBinding Background}">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal" />
                                <VisualState x:Name="MouseOver">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0:0:0.1" To="1" Storyboard.TargetProperty="Opacity"
                                                Storyboard.TargetName="MouseOverElement" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0" To="0.35" Storyboard.TargetProperty="Opacity"
                                                Storyboard.TargetName="contentPresenter" />
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="SelectionStates">
                                <VisualState x:Name="Unselected" />
                                <VisualState x:Name="Selected">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity"
                                                Storyboard.TargetName="SelectedElement" />
                                        <DoubleAnimation Duration="0" To="0" Storyboard.TargetProperty="Opacity"
                                                Storyboard.TargetName="MouseOverElement" />
                                        <ColorAnimation Duration="0" To="White"
                                                Storyboard.TargetProperty="(Control.Foreground).(SolidColorBrush.Color)"
                                                Storyboard.TargetName="contentPresenter" d:IsOptimized="True" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="SelectedUnfocused">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity"
                                                Storyboard.TargetName="SelectedElement" />
                                        <DoubleAnimation Duration="0" To="0" Storyboard.TargetProperty="Opacity"
                                                Storyboard.TargetName="MouseOverElement" />
                                        <ColorAnimation Duration="0" To="White"
                                                Storyboard.TargetProperty="(Control.Foreground).(SolidColorBrush.Color)"
                                                Storyboard.TargetName="contentPresenter" d:IsOptimized="True" />
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="FocusStates">
                                <VisualState x:Name="Focused">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0" Storyboard.TargetName="FocusVisualElement"
                                                Storyboard.TargetProperty="(FrameworkElement.Opacity)" To="1" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Unfocused" />
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="LayoutStates">
                                <VisualState x:Name="AfterLoaded" />
                                <VisualState x:Name="BeforeLoaded" />
                                <VisualState x:Name="BeforeUnloaded" />
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Rectangle x:Name="MouseOverElement" IsHitTestVisible="False" Opacity="0" RadiusX="0"
                                RadiusY="0" Fill="{StaticResource MouseOverSelectionBrush}" />
                        <Rectangle x:Name="SelectedElement" IsHitTestVisible="False" Opacity="0" RadiusX="0" RadiusY="1"
                                Fill="{StaticResource InputSelectionBrush}" />
                        <ContentControl x:Name="contentPresenter" Content="{TemplateBinding Content}"
                                ContentTemplate="{TemplateBinding ContentTemplate}"
                                Foreground="{TemplateBinding Foreground}"
                                HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                Margin="{TemplateBinding Padding}" />
                        <Rectangle x:Name="FocusVisualElement" IsHitTestVisible="False" Margin="2" Opacity="0"
                                RadiusX="1" RadiusY="1" Stroke="{StaticResource FocusVisualBrush}"
                                StrokeThickness="{StaticResource FocusVisualStrokeThickness}" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="ListBox">
        <Setter Property="Background" Value="{StaticResource InputBackgroundBrush}" />
        <Setter Property="BorderBrush" Value="{StaticResource ControlBorderBrush}" />
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="Foreground" Value="{StaticResource InputForegroundBrush}" />
        <Setter Property="IsTabStop" Value="False" />
        <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto" />
        <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" />
        <Setter Property="ScrollViewer.CanContentScroll" Value="true" />
        <Setter Property="ScrollViewer.PanningMode" Value="Both" />
        <Setter Property="KeyboardNavigation.ControlTabNavigation" Value="Once" />
        <Setter Property="VerticalContentAlignment" Value="Top" />
        <Setter Property="HorizontalContentAlignment" Value="Left" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ListBox">
                    <Grid>
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="ValidationStates">
                                <VisualState x:Name="Valid" />
                                <VisualState x:Name="InvalidUnfocused">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility"
                                                Storyboard.TargetName="ValidationErrorElement">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Visible}" />
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="InvalidFocused">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility"
                                                Storyboard.TargetName="ValidationErrorElement">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Visible}" />
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="IsOpen"
                                                Storyboard.TargetName="validationTooltip">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <System:Boolean>True</System:Boolean>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Grid>
                            <Border x:Name="OuterHighlight" BorderBrush="{StaticResource ControlOuterHighlightBrush}"
                                    BorderThickness="0,0,1,1" CornerRadius="3" Margin="0,0,-1,-1" />
                            <Border Background="{TemplateBinding Background}"
                                    BorderBrush="{TemplateBinding BorderBrush}"
                                    BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="3" Margin="0">
                                <ScrollViewer Focusable="false" Padding="{TemplateBinding Padding}"
                                        Background="Transparent" BorderBrush="Transparent">
                                    <ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                                </ScrollViewer>
                            </Border>
                            <!-- Inner Shadow. -->
                            <Border BorderBrush="{StaticResource InnerShadowDarkBrush}" BorderThickness="1,1,0,0"
                                    CornerRadius="2" Margin="1" />
                            <Border BorderBrush="{StaticResource InnerShadowLightBrush}" BorderThickness="1,1,0,0"
                                    CornerRadius="1" Margin="2,2,1,1" />
                        </Grid>
                        <Border x:Name="ValidationErrorElement" BorderBrush="{StaticResource ErrorBrush}"
                                BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="3"
                                Visibility="Collapsed">
                            <ToolTipService.ToolTip>
                                <ToolTip x:Name="validationTooltip"
                                        DataContext="{Binding RelativeSource={RelativeSource TemplatedParent}}"
                                        Placement="Right"
                                        PlacementTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}"
                                        Template="{StaticResource ValidationToolTipTemplate}">
                                    <ToolTip.Triggers>
                                        <EventTrigger RoutedEvent="Canvas.Loaded">
                                            <BeginStoryboard>
                                                <Storyboard>
                                                    <ObjectAnimationUsingKeyFrames
                                                            Storyboard.TargetProperty="IsHitTestVisible"
                                                            Storyboard.TargetName="validationTooltip">
                                                        <DiscreteObjectKeyFrame KeyTime="0">
                                                            <DiscreteObjectKeyFrame.Value>
                                                                <System:Boolean>true</System:Boolean>
                                                            </DiscreteObjectKeyFrame.Value>
                                                        </DiscreteObjectKeyFrame>
                                                    </ObjectAnimationUsingKeyFrames>
                                                </Storyboard>
                                            </BeginStoryboard>
                                        </EventTrigger>
                                    </ToolTip.Triggers>
                                </ToolTip>
                            </ToolTipService.ToolTip>
                            <Grid Background="Transparent" HorizontalAlignment="Right" Height="10" Margin="0,-4,-4,0"
                                    VerticalAlignment="Top" Width="10">
                                <Path Data="M 1,0 L6,0 A 2,2 90 0 1 8,2 L8,7 z" Fill="{StaticResource ErrorBrush}"
                                        Margin="-1,3,0,0" />
                            </Grid>
                        </Border>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- 
    ***************************************************************************
    ComboBox / ComboBoxItem
    ***************************************************************************
    -->

    <Style TargetType="ComboBoxItem">
        <Setter Property="Background" Value="Transparent" />
        <Setter Property="HorizontalContentAlignment" Value="Left" />
        <Setter Property="Padding" Value="6,4" />
        <Setter Property="KeyboardNavigation.ControlTabNavigation" Value="Local" />
        <Setter Property="VerticalContentAlignment" Value="Top" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ComboBoxItem">
                    <Grid Background="{TemplateBinding Background}">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal" />
                                <VisualState x:Name="MouseOver">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0:0:0.1" To="1" Storyboard.TargetProperty="Opacity"
                                                Storyboard.TargetName="MouseOverElement" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0" To="0.35" Storyboard.TargetProperty="Opacity"
                                                Storyboard.TargetName="contentPresenter" />
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="SelectionStates">
                                <VisualState x:Name="Unselected" />
                                <VisualState x:Name="Selected">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity"
                                                Storyboard.TargetName="SelectedElement" />
                                        <DoubleAnimation Duration="0" To="0" Storyboard.TargetProperty="Opacity"
                                                Storyboard.TargetName="MouseOverElement" />
                                        <ColorAnimation Duration="0" To="White"
                                                Storyboard.TargetProperty="(Control.Foreground).(SolidColorBrush.Color)"
                                                Storyboard.TargetName="contentPresenter" d:IsOptimized="True" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="SelectedUnfocused">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity"
                                                Storyboard.TargetName="SelectedElement" />
                                        <DoubleAnimation Duration="0" To="0" Storyboard.TargetProperty="Opacity"
                                                Storyboard.TargetName="MouseOverElement" />
                                        <ColorAnimation Duration="0" To="White"
                                                Storyboard.TargetProperty="(Control.Foreground).(SolidColorBrush.Color)"
                                                Storyboard.TargetName="contentPresenter" d:IsOptimized="True" />
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="FocusStates">
                                <VisualState x:Name="Focused">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0" Storyboard.TargetName="FocusVisualElement"
                                                Storyboard.TargetProperty="(FrameworkElement.Opacity)" To="1" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Unfocused" />
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="LayoutStates">
                                <VisualState x:Name="AfterLoaded" />
                                <VisualState x:Name="BeforeLoaded" />
                                <VisualState x:Name="BeforeUnloaded" />
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Rectangle x:Name="MouseOverElement" IsHitTestVisible="False" Opacity="0" RadiusX="0"
                                RadiusY="0" Fill="{StaticResource MouseOverSelectionBrush}" />
                        <Rectangle x:Name="SelectedElement" IsHitTestVisible="False" Opacity="0" RadiusX="0" RadiusY="1"
                                Fill="{StaticResource InputSelectionBrush}" />
                        <ContentPresenter x:Name="contentPresenter" Content="{TemplateBinding Content}"
                                ContentTemplate="{TemplateBinding ContentTemplate}"
                                HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                Margin="{TemplateBinding Padding}" />
                        <Rectangle x:Name="FocusVisualElement" IsHitTestVisible="False" Margin="2" Opacity="0"
                                RadiusX="1" RadiusY="1" Stroke="{StaticResource FocusVisualBrush}"
                                StrokeThickness="{StaticResource FocusVisualStrokeThickness}" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="ComboBoxButton" TargetType="ToggleButton">
        <Setter Property="Padding" Value="18,6" />
        <Setter Property="TextOptions.TextHintingMode" Value="Animated" />
        <Setter Property="Foreground" Value="{StaticResource ControlForeground}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ToggleButton">
                    <Grid x:Name="Root">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualStateGroup.Transitions>
                                    <VisualTransition GeneratedDuration="0:0:0.1" />
                                    <VisualTransition To="Pressed" />
                                    <VisualTransition From="Pressed" />
                                </VisualStateGroup.Transitions>
                                <VisualState x:Name="Normal" />
                                <VisualState x:Name="MouseOver">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0" Storyboard.TargetName="PressedElement"
                                                Storyboard.TargetProperty="(UIElement.Opacity)" To="0" />
                                        <DoubleAnimation Duration="0" Storyboard.TargetName="MouseOverElement"
                                                Storyboard.TargetProperty="(UIElement.Opacity)" To="1" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Pressed">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0" Storyboard.TargetName="NormalElement"
                                                Storyboard.TargetProperty="(UIElement.Opacity)" To="0.25" />
                                        <DoubleAnimation Duration="0" Storyboard.TargetName="PressedElement"
                                                Storyboard.TargetProperty="(UIElement.Opacity)" To="1" />
                                        <DoubleAnimation Duration="0" Storyboard.TargetName="MouseOverElement"
                                                Storyboard.TargetProperty="(UIElement.Opacity)" To="0" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0" Storyboard.TargetName="NormalElement"
                                                Storyboard.TargetProperty="(UIElement.Opacity)" To="0" />
                                        <DoubleAnimation Duration="0" Storyboard.TargetName="DisabledElement"
                                                Storyboard.TargetProperty="(UIElement.Opacity)" To="1" />
                                        <DoubleAnimation Duration="0" Storyboard.TargetName="HighlightElement"
                                                Storyboard.TargetProperty="(UIElement.Opacity)" To="0.5" />
                                        <DoubleAnimation Duration="0" Storyboard.TargetName="ContentHost"
                                                Storyboard.TargetProperty="(UIElement.Opacity)" To="0.75" />
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="FocusStates">
                                <VisualState x:Name="Focused" />
                                <VisualState x:Name="Unfocused" />
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="CheckStates">
                                <VisualState x:Name="Checked" />
                                <VisualState x:Name="Unchecked" />
                                <VisualState x:Name="Indeterminate" />
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Border x:Name="DisabledElement" Background="{StaticResource DisabledBrush}" CornerRadius="2"
                                Opacity="0">
                            <Border BorderBrush="{StaticResource DisabledBorderBrush}" BorderThickness="0,0,1,1"
                                    CornerRadius="2" />
                        </Border>
                        <Border x:Name="NormalElement" Background="{StaticResource ControlBackgroundNormal}"
                                CornerRadius="2" Effect="{StaticResource ControlShadowEffect}" />
                        <Border x:Name="MouseOverElement" Background="{StaticResource ControlBackgroundOver}"
                                CornerRadius="2" Opacity="0" />
                        <Border x:Name="PressedElement" Background="{StaticResource ControlBackgroundPressed}"
                                CornerRadius="2" Opacity="0" />
                        <Border x:Name="HighlightElement" BorderBrush="{StaticResource ControlHighlight}"
                                BorderThickness="1,1,0,0" CornerRadius="2" />
                        <ContentPresenter x:Name="ContentHost"
                                HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                Margin="{TemplateBinding Padding}"
                                VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
                            <ContentPresenter.Effect>
                                <DropShadowEffect Color="{StaticResource ColorForegroundShadowColor}" Direction="-90"
                                        BlurRadius="1" ShadowDepth="1" Opacity="0.5" />
                            </ContentPresenter.Effect>
                        </ContentPresenter>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="ComboBox">
        <Setter Property="Padding" Value="12,6,25,6" />
        <Setter Property="HorizontalContentAlignment" Value="Left" />
        <Setter Property="KeyboardNavigation.ControlTabNavigation" Value="Once" />
        <Setter Property="Foreground" Value="{StaticResource ControlForeground}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ComboBox">
                    <Grid>
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal" />
                                <VisualState x:Name="MouseOver" />
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="HighlightLine"
                                                Storyboard.TargetProperty="Opacity" To="0" Duration="0" />
                                        <DoubleAnimation Storyboard.TargetName="ShadowLine"
                                                Storyboard.TargetProperty="Opacity" To="0" Duration="0" />
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="FocusStates">
                                <VisualState x:Name="Focused" />
                                <VisualState x:Name="Unfocused" />
                                <VisualState x:Name="FocusedDropDown">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames
                                                Storyboard.TargetProperty="(UIElement.Visibility)"
                                                Storyboard.TargetName="PopupBorder">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Visible}" />
                                        </ObjectAnimationUsingKeyFrames>

                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="EditStates">
                                <VisualState x:Name="Editable" />
                                <VisualState x:Name="Uneditable" />
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="ValidationStates">
                                <VisualState x:Name="Valid" />
                                <VisualState x:Name="InvalidFocused" />
                                <VisualState x:Name="InvalidUnfocused" />
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Border x:Name="ContentPresenterBorder">
                            <Grid x:Name="MainGrid">
                                <ToggleButton x:Name="DropDownToggle" Style="{StaticResource ComboBoxButton}"
                                        IsChecked="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
                                        HorizontalAlignment="Stretch" Margin="0" VerticalAlignment="Stretch"
                                        HorizontalContentAlignment="Right" Padding="3">
                                    <Path x:Name="BtnArrow" Width="8" Height="4" HorizontalAlignment="Right"
                                            Margin="0,0,6,0" Data="M0,0 L1,0 0.5,1Z" Fill="#606060" Stretch="Fill" />
                                </ToggleButton>
                                <Rectangle x:Name="HighlightLine" Width="1" HorizontalAlignment="Right"
                                        Margin="0,2,26,2">
                                    <Rectangle.Fill>
                                        <LinearGradientBrush EndPoint="1,1" StartPoint="0,0">
                                            <GradientStop Color="#0FFF" Offset="0" />
                                            <GradientStop Color="#FFFF" Offset="0.3" />
                                            <GradientStop Color="#AFFF" Offset="0.7" />
                                            <GradientStop Color="#0FFF" Offset="1" />
                                        </LinearGradientBrush>
                                    </Rectangle.Fill>
                                </Rectangle>
                                <Rectangle x:Name="ShadowLine" Width="1" HorizontalAlignment="Right" Margin="0,2,27,2">
                                    <Rectangle.Fill>
                                        <LinearGradientBrush EndPoint="1,1" StartPoint="0,0">
                                            <GradientStop Color="#0000" Offset="0" />
                                            <GradientStop Color="#3000" Offset="0.3" />
                                            <GradientStop Color="#3000" Offset="0.7" />
                                            <GradientStop Color="#0000" Offset="1" />
                                        </LinearGradientBrush>
                                    </Rectangle.Fill>
                                </Rectangle>
                                <ContentPresenter x:Name="ContentPresenter"
                                        ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}"
                                        Content="{TemplateBinding SelectionBoxItem}"
                                        HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                        Margin="{TemplateBinding Padding}"
                                        VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
                                    <ContentPresenter.Effect>
                                        <DropShadowEffect Color="{StaticResource ColorForegroundShadowColor}"
                                                Direction="-90" BlurRadius="1" ShadowDepth="1" Opacity="0.5" />
                                    </ContentPresenter.Effect>

                                </ContentPresenter>
                                <Popup x:Name="PART_Popup" Margin="0,1,0,0" HorizontalAlignment="Stretch"
                                        MinWidth="{Binding ActualWidth, ElementName=MainGrid}"
                                        IsOpen="{Binding IsDropDownOpen, RelativeSource={RelativeSource TemplatedParent}}">
                                    <Border x:Name="PopupBorder" Height="Auto" HorizontalAlignment="Stretch"
                                            Background="{StaticResource InputBackgroundBrush}" CornerRadius="0,0,4,4"
                                            Effect="{StaticResource ControlShadowEffect}" Visibility="Visible">
                                        <ScrollViewer x:Name="ScrollViewer" BorderThickness="0" Padding="0"
                                                Margin="0,0,0,4">
                                            <ItemsPresenter />

                                        </ScrollViewer>
                                    </Border>
                                </Popup>
                            </Grid>
                        </Border>

                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- 
    ***************************************************************************
    Slider
    ***************************************************************************
    -->

    <Style x:Key="HorizontalSliderThumb" TargetType="Thumb">
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="IsTabStop" Value="False" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Thumb">
                    <Grid>
                        <Path x:Name="ThumbElement"
                                Data="M-0.40,4.15C-0.40,3.60 0.37,2.89 0.92,2.89L8.07,2.89C8.62,2.89 9.40,3.60 9.40,4.15L9.40,11.06C 9.40,11.61 4.40,15.5 4.40,15.5C4.40,15.5 -0.40,11.61 -0.40,11.06z"
                                Stretch="Fill" StrokeThickness="0" UseLayoutRounding="False">
                            <Path.Stroke>
                                <LinearGradientBrush StartPoint="0,0" EndPoint="1,1">
                                    <GradientStop Offset="0" Color="#FFFDFDFD" />
                                    <GradientStop Offset="1" Color="#FF868788" />
                                </LinearGradientBrush>
                            </Path.Stroke>
                            <Path.Fill>
                                <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
                                    <GradientStop Offset="0" Color="#FFFDFDFD" />
                                    <GradientStop Offset="1" Color="#FF9D9D9E" />
                                </LinearGradientBrush>
                            </Path.Fill>
                            <Path.Effect>
                                <DropShadowEffect BlurRadius="4" Opacity="0.5" ShadowDepth="1" />
                            </Path.Effect>
                        </Path>
                        <Border Margin="0,0,0,4" BorderBrush="{StaticResource ControlHighlight}"
                                BorderThickness="1,1,0,0" CornerRadius="3" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style x:Key="VerticalSliderThumb" TargetType="Thumb">
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="IsTabStop" Value="False" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Thumb">
                    <Grid Height="12" Width="16">
                        <Path
                                Data="M1.6027589,0 L10.366944,0 C11.068047,0 16,6.1111116 16,6.1111116 C16,6.1111116 11.068047,12 10.366944,12 L1.6027589,12 C0.90168238,12 0,11.043701 0,10.368687 L0,1.6313124 C0,0.9562912 0.90168238,0 1.6027589,0 z"
                                Stretch="Fill" StrokeThickness="0" UseLayoutRounding="False">
                            <Path.Effect>
                                <DropShadowEffect BlurRadius="4" Opacity="0.5" ShadowDepth="1" />
                            </Path.Effect>
                            <Path.Fill>
                                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                    <GradientStop Color="#FFFDFDFD" Offset="0" />
                                    <GradientStop Color="#FF9D9D9E" Offset="1" />
                                </LinearGradientBrush>
                            </Path.Fill>
                            <Path.Stroke>
                                <LinearGradientBrush EndPoint="1,1" StartPoint="0,0">
                                    <GradientStop Color="#FFFDFDFD" Offset="0" />
                                    <GradientStop Color="#FF868788" Offset="1" />
                                </LinearGradientBrush>
                            </Path.Stroke>
                        </Path>
                        <Border BorderBrush="{StaticResource ControlHighlight}" BorderThickness="1,1,0,0"
                                CornerRadius="3" Margin="0,0,4,0" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <ControlTemplate x:Key="SliderRepeatButtonTemplate" TargetType="{x:Type RepeatButton}">
        <Grid x:Name="Root" Background="Transparent" Opacity="0" />
    </ControlTemplate>

    <ControlTemplate x:Key="RepeatButtonHorizontalValueTemplate" TargetType="{x:Type RepeatButton}">
        <Border x:Name="HorizontalValueElement" BorderThickness="1" CornerRadius="2" Height="8" Margin="0,3,-8,0"
                VerticalAlignment="Top">
            <Border.BorderBrush>
                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                    <GradientStop Color="#FF38383C" Offset="0" />
                    <GradientStop Color="#FF424247" Offset="1" />
                </LinearGradientBrush>
            </Border.BorderBrush>
            <Border BorderThickness="1" CornerRadius="1">
                <Border.BorderBrush>
                    <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                        <GradientStop Color="#FFF1F1F1" Offset="0" />
                        <GradientStop Color="#FF969696" Offset="1" />
                    </LinearGradientBrush>
                </Border.BorderBrush>
                <Border.Background>
                    <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                        <GradientStop Color="#FFCCCCCC" Offset="0" />
                        <GradientStop Color="#FF9F9F9F" Offset="1" />
                    </LinearGradientBrush>
                </Border.Background>
            </Border>
        </Border>
    </ControlTemplate>
    <ControlTemplate x:Key="RepeatButtonVerticalValueTemplate" TargetType="{x:Type RepeatButton}">
        <Border x:Name="HorizontalValueElement" BorderThickness="1" CornerRadius="2" Width="8" Height="Auto"
                Margin="0,-8,3,0" VerticalAlignment="Stretch">
            <Border.BorderBrush>
                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                    <GradientStop Color="#FF38383C" Offset="0" />
                    <GradientStop Color="#FF424247" Offset="1" />
                </LinearGradientBrush>
            </Border.BorderBrush>
            <Border BorderThickness="1" CornerRadius="1">
                <Border.BorderBrush>
                    <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                        <GradientStop Color="#FFF1F1F1" Offset="0" />
                        <GradientStop Color="#FF969696" Offset="1" />
                    </LinearGradientBrush>
                </Border.BorderBrush>
                <Border.Background>
                    <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                        <GradientStop Color="#FFCCCCCC" Offset="0" />
                        <GradientStop Color="#FF9F9F9F" Offset="1" />
                    </LinearGradientBrush>
                </Border.Background>
            </Border>
        </Border>
    </ControlTemplate>
    <Style TargetType="Slider">
        <Setter Property="Background" Value="{StaticResource ControlBackgroundAltBrush}" />
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="Maximum" Value="10" />
        <Setter Property="Minimum" Value="0" />
        <Setter Property="Value" Value="0" />
        <Setter Property="BorderBrush" Value="{StaticResource ControlBorderBrush}" />
        <Setter Property="IsTabStop" Value="False" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Slider">
                    <Grid x:Name="Root">

                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal" />
                                <VisualState x:Name="MouseOver" />
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Duration="0"
                                                Storyboard.TargetProperty="Visibility"
                                                Storyboard.TargetName="HorizontalTrackRectangleDisabledOverlay">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Visible}" />
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Duration="0"
                                                Storyboard.TargetProperty="Visibility"
                                                Storyboard.TargetName="VerticalTrackRectangleDisabledOverlay">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Visible}" />
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="FocusStates">
                                <VisualState x:Name="Focused">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0" Storyboard.TargetName="FocusVisualElement"
                                                Storyboard.TargetProperty="(FrameworkElement.Opacity)" To="1" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Unfocused" />
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Grid x:Name="HorizontalTemplate">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="*" />
                            </Grid.ColumnDefinitions>

                            <Grid Grid.ColumnSpan="3" Height="8" Margin="0,3,0,0" VerticalAlignment="Top">
                                <Border x:Name="Border" BorderBrush="#D0505050" BorderThickness="1" CornerRadius="2"
                                        Opacity="1">
                                    <Border.Background>
                                        <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                                            <GradientStop Color="#57575c" Offset="0.3" />
                                            <GradientStop Color="#505054" Offset="1.0" />
                                        </LinearGradientBrush>
                                    </Border.Background>
                                </Border>
                                <Border x:Name="DarkEdge" BorderBrush="{StaticResource ControlDarkEdge}"
                                        BorderThickness="1,1,0,0" CornerRadius="2" Margin="0" />
                                <Border x:Name="OuterHighlight"
                                        BorderBrush="{StaticResource ControlOuterHighlightBrush}"
                                        BorderThickness="0,0,1,1" CornerRadius="2" Margin="0,0,-1,-1" />
                                <Border x:Name="InnerShadowDark" BorderBrush="#50303030" BorderThickness="1,1,0,0"
                                        CornerRadius="1" Margin="1" />
                                <Border x:Name="InnerShadowLight" BorderBrush="#20303030" BorderThickness="1,1,0,0"
                                        CornerRadius="1" Margin="2" />
                            </Grid>
                            <Border x:Name="HorizontalValueElement" BorderThickness="1" CornerRadius="2"
                                    Grid.ColumnSpan="2" Height="8" Margin="0,3,4,0" VerticalAlignment="Top">
                                <Border.BorderBrush>
                                    <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                        <GradientStop Color="#FF38383C" Offset="0" />
                                        <GradientStop Color="#FF424247" Offset="1" />
                                    </LinearGradientBrush>
                                </Border.BorderBrush>
                                <Border BorderThickness="1" CornerRadius="1">
                                    <Border.BorderBrush>
                                        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                            <GradientStop Color="#FFF1F1F1" Offset="0" />
                                            <GradientStop Color="#FF969696" Offset="1" />
                                        </LinearGradientBrush>
                                    </Border.BorderBrush>
                                    <Border.Background>
                                        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                            <GradientStop Color="#FFCCCCCC" Offset="0" />
                                            <GradientStop Color="#FF9F9F9F" Offset="1" />
                                        </LinearGradientBrush>
                                    </Border.Background>
                                </Border>
                            </Border>
                            <Rectangle x:Name="HorizontalTrackRectangleDisabledOverlay" Grid.Column="0"
                                    Grid.ColumnSpan="3" Fill="{StaticResource DisabledBrush}" Height="10"
                                    Margin="0,3,0,0" Opacity=".55" RadiusX="2" RadiusY="2" VerticalAlignment="Top"
                                    Visibility="Collapsed" />
                            <Track x:Name="PART_Track" Grid.Row="0" Grid.ColumnSpan="3">
                                <Track.DecreaseRepeatButton>

                                    <RepeatButton x:Name="HorizontalTrackLargeChangeDecreaseRepeatButton" Height="18"
                                            IsTabStop="False"
                                            Template="{DynamicResource RepeatButtonHorizontalValueTemplate}" />
                                </Track.DecreaseRepeatButton>
                                <Track.IncreaseRepeatButton>

                                    <RepeatButton x:Name="HorizontalTrackLargeChangeIncreaseRepeatButton" Height="18"
                                            IsTabStop="False" Template="{DynamicResource SliderRepeatButtonTemplate}" />
                                </Track.IncreaseRepeatButton>
                                <Track.Thumb>
                                    <Thumb x:Name="HorizontalThumb" Height="16" IsTabStop="True"
                                            Style="{StaticResource HorizontalSliderThumb}" Width="12"
                                            VerticalAlignment="Top" />

                                </Track.Thumb>
                            </Track>

                        </Grid>

                        <Rectangle x:Name="FocusVisualElement" IsHitTestVisible="False" Margin="-2" Opacity="0"
                                RadiusX="2" RadiusY="2" Stroke="{StaticResource FocusVisualBrush}"
                                StrokeThickness="{StaticResource FocusVisualStrokeThickness}" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>

        </Setter>
        <Style.Triggers>
            <Trigger Property="Orientation" Value="Vertical">
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type Slider}">
                            <Grid x:Name="VerticalTemplate">
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="*" />
                                    <RowDefinition Height="Auto" />
                                    <RowDefinition Height="Auto" />
                                </Grid.RowDefinitions>
                                <Grid Grid.RowSpan="3" Width="8" Margin="3,0,0,0" HorizontalAlignment="Left">
                                    <Border x:Name="VertBorder" BorderBrush="#D0505050" BorderThickness="1"
                                            CornerRadius="2" Opacity="1">
                                        <Border.Background>
                                            <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                                                <GradientStop Color="#57575c" Offset="0.3" />
                                                <GradientStop Color="#505054" Offset="1.0" />
                                            </LinearGradientBrush>
                                        </Border.Background>
                                    </Border>
                                    <Border x:Name="VertDarkEdge" BorderBrush="{StaticResource ControlDarkEdge}"
                                            BorderThickness="1,1,0,0" CornerRadius="2" Margin="0" />
                                    <Border x:Name="VertOuterHighlight"
                                            BorderBrush="{StaticResource ControlOuterHighlightBrush}"
                                            BorderThickness="0,0,1,1" CornerRadius="2" Margin="0,0,-1,-1" />
                                    <Border x:Name="VertInnerShadowDark" BorderBrush="#50303030"
                                            BorderThickness="1,1,0,0" CornerRadius="1" Margin="1" />
                                    <Border x:Name="VertInnerShadowLight" BorderBrush="#20303030"
                                            BorderThickness="1,1,0,0" CornerRadius="1" Margin="2" />
                                </Grid>

                                <Track x:Name="PART_Track" Grid.Row="0" Grid.RowSpan="3">
                                    <Track.DecreaseRepeatButton>

                                        <RepeatButton x:Name="VerticalTrackLargeChangeDecreaseRepeatButton" Width="18"
                                                IsTabStop="False"
                                                Template="{DynamicResource RepeatButtonVerticalValueTemplate}" />
                                    </Track.DecreaseRepeatButton>
                                    <Track.IncreaseRepeatButton>

                                        <RepeatButton x:Name="VerticalTrackLargeChangeIncreaseRepeatButton" Width="18"
                                                IsTabStop="False"
                                                Template="{DynamicResource SliderRepeatButtonTemplate}" />
                                    </Track.IncreaseRepeatButton>
                                    <Track.Thumb>
                                        <Thumb x:Name="VerticalSliderThumb" Width="16" IsTabStop="True"
                                                Style="{StaticResource VerticalSliderThumb}" Height="12"
                                                VerticalAlignment="Top" />

                                    </Track.Thumb>
                                </Track>

                            </Grid>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Trigger>
        </Style.Triggers>
    </Style>

    <!-- 
    ***************************************************************************
    ScrollBar
    ***************************************************************************
    -->

    <ControlTemplate x:Key="HorizontalThumbTemplate" TargetType="Thumb">
        <Grid>
            <VisualStateManager.VisualStateGroups>
                <VisualStateGroup x:Name="CommonStates">
                    <VisualStateGroup.Transitions>
                        <VisualTransition GeneratedDuration="0:0:0.1" />
                    </VisualStateGroup.Transitions>
                    <VisualState x:Name="Normal" />
                    <VisualState x:Name="MouseOver">
                        <Storyboard>
                            <DoubleAnimation Duration="0:0:0" Storyboard.TargetName="Background"
                                    Storyboard.TargetProperty="Opacity" To="1.0" />
                        </Storyboard>
                    </VisualState>
                    <VisualState x:Name="Disabled">
                        <Storyboard>
                            <DoubleAnimation Duration="0:0:0" Storyboard.TargetName="Background"
                                    Storyboard.TargetProperty="Opacity" To="0" />
                        </Storyboard>
                    </VisualState>
                </VisualStateGroup>
            </VisualStateManager.VisualStateGroups>
            <Border x:Name="Background" Opacity="0.5" Margin="1" CornerRadius="1,4,2,2" BorderBrush="White"
                    BorderThickness="1,1,0,0">
                <Border.Effect>
                    <DropShadowEffect ShadowDepth="0" Opacity="0.3" BlurRadius="4" />
                </Border.Effect>
                <Border.Background>
                    <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                        <GradientStop Color="#f8f8f8" Offset="0.1" />
                        <GradientStop Color="#c0c0c0" Offset="1.0" />
                    </LinearGradientBrush>
                </Border.Background>
                <Border CornerRadius="0,2,2,2" BorderBrush="#40000000" BorderThickness="0,0,1,1" Margin="-1,-1,0,0" />
            </Border>
        </Grid>
    </ControlTemplate>
    <ControlTemplate x:Key="LargeChangeButton" TargetType="RepeatButton">
        <Grid x:Name="Root" Background="Transparent">
            <VisualStateManager.VisualStateGroups>
                <VisualStateGroup x:Name="CommonStates">
                    <VisualState x:Name="Normal" />
                </VisualStateGroup>
            </VisualStateManager.VisualStateGroups>
        </Grid>
    </ControlTemplate>
    <ControlTemplate x:Key="SmallChangeButton" TargetType="RepeatButton">
        <Grid x:Name="Root">
            <VisualStateManager.VisualStateGroups>
                <VisualStateGroup x:Name="CommonStates">
                    <VisualStateGroup.Transitions>
                        <VisualTransition GeneratedDuration="0:0:0.1" />
                    </VisualStateGroup.Transitions>
                    <VisualState x:Name="Normal" />
                    <VisualState x:Name="MouseOver">
                        <Storyboard>
                            <ColorAnimation Storyboard.TargetName="Background"
                                    Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)" To="#2000" />
                        </Storyboard>
                    </VisualState>
                    <VisualState x:Name="Pressed">
                        <Storyboard>
                            <ColorAnimation Storyboard.TargetName="Background"
                                    Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)" To="#4000" />
                        </Storyboard>
                    </VisualState>
                    <VisualState x:Name="Disabled">
                        <Storyboard>
                            <DoubleAnimation Duration="0:0:0" Storyboard.TargetName="Background"
                                    Storyboard.TargetProperty="Opacity" To=".7" />
                        </Storyboard>
                    </VisualState>
                </VisualStateGroup>
            </VisualStateManager.VisualStateGroups>
            <Border x:Name="Background" Background="#0000">
                <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" />
            </Border>
        </Grid>
    </ControlTemplate>

    <ControlTemplate x:Key="VerticalThumbTemplate" TargetType="Thumb">
        <Grid>
            <VisualStateManager.VisualStateGroups>
                <VisualStateGroup x:Name="CommonStates">
                    <VisualStateGroup.Transitions>
                        <VisualTransition GeneratedDuration="0:0:0.1" />
                    </VisualStateGroup.Transitions>
                    <VisualState x:Name="Normal" />
                    <VisualState x:Name="MouseOver">
                        <Storyboard>
                            <DoubleAnimation Duration="0:0:0" Storyboard.TargetName="Background"
                                    Storyboard.TargetProperty="Opacity" To="1.0" />
                        </Storyboard>
                    </VisualState>
                    <VisualState x:Name="Disabled">
                        <Storyboard>
                            <DoubleAnimation Duration="0:0:0" Storyboard.TargetName="Background"
                                    Storyboard.TargetProperty="Opacity" To="0" />
                        </Storyboard>
                    </VisualState>
                </VisualStateGroup>
            </VisualStateManager.VisualStateGroups>
            <Border x:Name="Background" Margin="1" Opacity="0.5" CornerRadius="1,4,2,2" BorderBrush="White"
                    BorderThickness="1,1,0,0">
                <Border.Effect>
                    <DropShadowEffect ShadowDepth="0" Opacity="0.3" BlurRadius="4" />
                </Border.Effect>
                <Border.Background>
                    <LinearGradientBrush StartPoint="0,0" EndPoint="1,0">
                        <GradientStop Color="#f8f8f8" Offset="0.1" />
                        <GradientStop Color="#c0c0c0" Offset="1.0" />
                    </LinearGradientBrush>
                </Border.Background>
                <Border CornerRadius="0,2,2,2" BorderBrush="#40000000" BorderThickness="0,0,1,1" Margin="-1,-1,0,0" />
            </Border>
        </Grid>
    </ControlTemplate>

    <Style TargetType="{x:Type ScrollBar}">
        <Setter Property="Background" Value="{StaticResource ScrollBackgroundBrush}" />
        <Setter Property="Stylus.IsPressAndHoldEnabled" Value="false" />
        <Setter Property="Stylus.IsFlicksEnabled" Value="false" />
        <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" />
        <Setter Property="Width" Value="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}" />
        <Setter Property="MinWidth" Value="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ScrollBar}">
                    <Grid x:Name="Bg" Background="{TemplateBinding Background}" SnapsToDevicePixels="true">

                        <Grid.RowDefinitions>
                            <RowDefinition
                                    MaxHeight="{DynamicResource {x:Static SystemParameters.VerticalScrollBarButtonHeightKey}}" />
                            <RowDefinition Height="0.00001*" />
                            <RowDefinition
                                    MaxHeight="{DynamicResource {x:Static SystemParameters.VerticalScrollBarButtonHeightKey}}" />
                        </Grid.RowDefinitions>
                        <RepeatButton Command="{x:Static ScrollBar.LineUpCommand}"
                                IsEnabled="{TemplateBinding IsMouseOver}" Template="{StaticResource SmallChangeButton}">
                            <Path Width="7" Height="4" Data="M0,1 L1,1 0.5,0Z" Fill="#606060" Stretch="Fill" />
                        </RepeatButton>
                        <Track x:Name="PART_Track" IsDirectionReversed="true" Grid.Row="1">
                            <Track.DecreaseRepeatButton>
                                <RepeatButton Command="{x:Static ScrollBar.PageUpCommand}"
                                        Template="{StaticResource LargeChangeButton}" />
                            </Track.DecreaseRepeatButton>
                            <Track.IncreaseRepeatButton>
                                <RepeatButton Command="{x:Static ScrollBar.PageDownCommand}"
                                        Template="{StaticResource LargeChangeButton}" />
                            </Track.IncreaseRepeatButton>
                            <Track.Thumb>
                                <Thumb Template="{StaticResource VerticalThumbTemplate}" />
                            </Track.Thumb>
                        </Track>
                        <RepeatButton Command="{x:Static ScrollBar.LineDownCommand}"
                                IsEnabled="{TemplateBinding IsMouseOver}" Grid.Row="2"
                                Template="{StaticResource SmallChangeButton}">
                            <Path Width="7" Height="4" Data="M0,0 L1,0 0.5,1Z" Fill="#606060" Stretch="Fill" />
                        </RepeatButton>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter Property="Background" TargetName="Bg"
                                    Value="{StaticResource ScrollBarDisabledBackground}" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <Trigger Property="Orientation" Value="Horizontal">
                <Setter Property="Width" Value="Auto" />
                <Setter Property="MinWidth" Value="0" />
                <Setter Property="Height"
                        Value="{DynamicResource {x:Static SystemParameters.HorizontalScrollBarHeightKey}}" />
                <Setter Property="MinHeight"
                        Value="{DynamicResource {x:Static SystemParameters.HorizontalScrollBarHeightKey}}" />

                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type ScrollBar}">
                            <Grid x:Name="Bg2" Background="{TemplateBinding Background}" SnapsToDevicePixels="true">

                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition
                                            MaxWidth="{DynamicResource {x:Static SystemParameters.HorizontalScrollBarButtonWidthKey}}" />
                                    <ColumnDefinition Width="0.00001*" />
                                    <ColumnDefinition
                                            MaxWidth="{DynamicResource {x:Static SystemParameters.HorizontalScrollBarButtonWidthKey}}" />
                                </Grid.ColumnDefinitions>

                                <RepeatButton Command="{x:Static ScrollBar.LineLeftCommand}"
                                        IsEnabled="{TemplateBinding IsMouseOver}"
                                        Template="{StaticResource SmallChangeButton}">
                                    <Path Width="4" Height="7" Data="M0,0.5 L1,1 1,0Z" Fill="#404040" Stretch="Fill"
                                            HorizontalAlignment="Left" />
                                </RepeatButton>
                                <Track x:Name="PART_Track" Grid.Column="1">
                                    <Track.DecreaseRepeatButton>
                                        <RepeatButton Command="{x:Static ScrollBar.PageLeftCommand}"
                                                Template="{StaticResource LargeChangeButton}" />
                                    </Track.DecreaseRepeatButton>
                                    <Track.IncreaseRepeatButton>
                                        <RepeatButton Command="{x:Static ScrollBar.PageRightCommand}"
                                                Template="{StaticResource LargeChangeButton}" />
                                    </Track.IncreaseRepeatButton>
                                    <Track.Thumb>
                                        <Thumb Template="{StaticResource HorizontalThumbTemplate}" />
                                    </Track.Thumb>
                                </Track>
                                <RepeatButton Grid.Column="2" Command="{x:Static ScrollBar.LineRightCommand}"
                                        IsEnabled="{TemplateBinding IsMouseOver}"
                                        Template="{StaticResource SmallChangeButton}">
                                    <Path Width="4" Height="7" Data="M0,0 L1,0.5 0,1Z" Fill="#606060" Stretch="Fill" />
                                </RepeatButton>
                            </Grid>
                            <ControlTemplate.Triggers>
                                <Trigger Property="IsEnabled" Value="false">
                                    <Setter Property="Background" TargetName="Bg2"
                                            Value="{DynamicResource ScrollBarDisabledBackground}" />
                                </Trigger>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Trigger>
        </Style.Triggers>
    </Style>
    
    <!-- 
    ***************************************************************************
    ScrollViewer
    ***************************************************************************
    -->

    <Style TargetType="ScrollViewer">
        <Setter Property="HorizontalContentAlignment" Value="Left" />
        <Setter Property="VerticalContentAlignment" Value="Top" />
        <!--<Setter Property="HorizontalScrollBarVisibility" Value="Auto" />-->
        <Setter Property="VerticalScrollBarVisibility" Value="Auto" />
        <Setter Property="Padding" Value="0" />
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="BorderBrush" Value="#80404040" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ScrollViewer">
                    <Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="2.5">
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="*" />
                                <RowDefinition Height="Auto" />
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="*" />
                                <ColumnDefinition Width="Auto" />
                            </Grid.ColumnDefinitions>
                            <Border Grid.Column="1" Grid.Row="1" Background="Transparent" CornerRadius="0,0,2.5,0"
                                    Margin="0,-5,0,0" />
                            <ScrollContentPresenter x:Name="PART_ScrollContentPresenter" CanHorizontallyScroll="False"
                                    CanVerticallyScroll="False" ContentTemplate="{TemplateBinding ContentTemplate}"
                                    Content="{TemplateBinding Content}" Margin="{TemplateBinding Padding}" />

                            <Border Grid.Column="1" Grid.Row="1" Background="{StaticResource ScrollBackgroundBrush}"
                                    CornerRadius="0,0,2.5,0" />
                            <ScrollBar x:Name="PART_VerticalScrollBar" Width="18" Grid.Column="1" Grid.Row="0"
                                    IsTabStop="False" Maximum="{TemplateBinding ScrollableHeight}" Minimum="0"
                                    Orientation="Vertical"
                                    Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}"
                                    Value="{Binding VerticalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}"
                                    ViewportSize="{TemplateBinding ViewportHeight}" />
                            <ScrollBar x:Name="PART_HorizontalScrollBar" Height="18" Grid.Column="0" Grid.Row="1"
                                    IsTabStop="False" Maximum="{TemplateBinding ScrollableWidth}" Minimum="0"
                                    Orientation="Horizontal"
                                    Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}"
                                    Value="{Binding HorizontalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}"
                                    ViewportSize="{TemplateBinding ViewportWidth}" />
                        </Grid>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- 
    ***************************************************************************
    DarkTextBox
    ***************************************************************************
    -->

    <Style x:Key="DarkTextBox" TargetType="TextBox">
        <Setter Property="Background" Value="{StaticResource DarkControlBackgroundBrush}" />
        <Setter Property="BorderBrush" Value="{StaticResource DarkControlBorderBrush}" />
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="Foreground" Value="White" />
        <Setter Property="Padding" Value="5,4,5,4" />
        <Setter Property="SelectionBrush" Value="{StaticResource InputSelectionBrush}" />
        <!--<Setter Property="SelectionBackground" Value="{StaticResource InputSelectionBrush}" />
        <Setter Property="SelectionForeground" Value="{StaticResource DarkControlForegroundBrush}" />-->
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="TextBox">
                    <Grid x:Name="RootElement">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal" />
                                <VisualState x:Name="MouseOver" />
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0" To="0.55" Storyboard.TargetProperty="Opacity"
                                                Storyboard.TargetName="DisabledVisualElement" />
                                        <DoubleAnimation Duration="0" To="0.5"
                                                Storyboard.TargetProperty="(UIElement.Opacity)"
                                                Storyboard.TargetName="PART_ContentHost" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="ReadOnly">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0" To="0.55" Storyboard.TargetProperty="Opacity"
                                                Storyboard.TargetName="ReadOnlyVisualElement" />
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="FocusStates">
                                <VisualState x:Name="Focused">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0" Storyboard.TargetName="FocusVisualElement"
                                                Storyboard.TargetProperty="(FrameworkElement.Opacity)" To="1" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Unfocused" />
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="ValidationStates">
                                <VisualState x:Name="Valid" />
                                <VisualState x:Name="InvalidUnfocused">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility"
                                                Storyboard.TargetName="ValidationErrorElement">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Visible}" />
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="InvalidFocused">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility"
                                                Storyboard.TargetName="ValidationErrorElement">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Visible}" />
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="IsOpen"
                                                Storyboard.TargetName="validationTooltip">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <System:Boolean>True</System:Boolean>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Border x:Name="Border" Background="{TemplateBinding Background}"
                                BorderBrush="{TemplateBinding BorderBrush}"
                                BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="2.5" Opacity="1">
                            <Grid>
                                <Border x:Name="ReadOnlyVisualElement" Background="{StaticResource DarkReadOnlyBrush}"
                                        CornerRadius="2" Opacity="0" />
                                <ScrollViewer x:Name="PART_ContentHost" BorderThickness="0" IsTabStop="False" Margin="1"
                                        Padding="{TemplateBinding Padding}" Foreground="{TemplateBinding Foreground}" />
                            </Grid>
                        </Border>
                        <Border x:Name="DarkEdge" BorderBrush="{StaticResource ControlDarkEdge}"
                                BorderThickness="1,1,0,0" CornerRadius="2.5" Margin="0" />
                        <Border x:Name="OuterHighlight" BorderBrush="{StaticResource ControlOuterHighlightBrush}"
                                BorderThickness="0,0,1,1" CornerRadius="3" Margin="0,0,-1,-1" />
                        <Border x:Name="InnerShadowDark" BorderBrush="{StaticResource DarkInnerShadowDarkBrush}"
                                BorderThickness="1,1,0,0" CornerRadius="2" Margin="1" />
                        <Border x:Name="InnerShadowLight" BorderBrush="{StaticResource DarkInnerShadowLightBrush}"
                                BorderThickness="1,1,0,0" CornerRadius="1" Margin="2" />
                        <Border x:Name="DisabledVisualElement" Background="{StaticResource DarkDisabledBrush}"
                                IsHitTestVisible="False" Margin="1" Opacity="0" CornerRadius="2" />
                        <Rectangle x:Name="FocusVisualElement" IsHitTestVisible="False" Margin="2" Opacity="0"
                                RadiusX="1" RadiusY="1" Stroke="{StaticResource FocusVisualBrush}"
                                StrokeThickness="{StaticResource FocusVisualStrokeThickness}" />
                        <Border x:Name="ValidationErrorElement" BorderBrush="{StaticResource ErrorBrush}"
                                BorderThickness="1" CornerRadius="3" Visibility="Collapsed">
                            <ToolTipService.ToolTip>
                                <ToolTip x:Name="validationTooltip"
                                        DataContext="{Binding RelativeSource={RelativeSource TemplatedParent}}"
                                        Placement="Right"
                                        PlacementTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}"
                                        Template="{StaticResource ValidationToolTipTemplate}">
                                    <ToolTip.Triggers>
                                        <EventTrigger RoutedEvent="Canvas.Loaded">
                                            <BeginStoryboard>
                                                <Storyboard>
                                                    <ObjectAnimationUsingKeyFrames
                                                            Storyboard.TargetProperty="IsHitTestVisible"
                                                            Storyboard.TargetName="validationTooltip">
                                                        <DiscreteObjectKeyFrame KeyTime="0" Value="True" />
                                                    </ObjectAnimationUsingKeyFrames>
                                                </Storyboard>
                                            </BeginStoryboard>
                                        </EventTrigger>
                                    </ToolTip.Triggers>
                                </ToolTip>
                            </ToolTipService.ToolTip>
                            <Grid Background="Transparent" HorizontalAlignment="Right" Height="12" Margin="1,-4,-4,0"
                                    VerticalAlignment="Top" Width="12">
                                <Path Data="M 1,0 L6,0 A 2,2 90 0 1 8,2 L8,7 z" Fill="{StaticResource ErrorBrush}"
                                        Margin="1,3,0,0" />
                            </Grid>
                        </Border>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- 
    ***************************************************************************
    DarkPasswordBox
    ***************************************************************************
    -->

    <Style x:Key="DarkPasswordBox" TargetType="PasswordBox">
        <Setter Property="Background" Value="{StaticResource DarkControlBackgroundBrush}" />
        <Setter Property="BorderBrush" Value="{StaticResource DarkControlBorderBrush}" />
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="Foreground" Value="{StaticResource DarkControlForegroundBrush}" />
        <Setter Property="Padding" Value="5,4,5,4" />
        <Setter Property="SelectionBrush" Value="{StaticResource InputSelectionBrush}" />
        <!--<Setter Property="SelectionBackground" Value="{StaticResource InputSelectionBrush}" />
        <Setter Property="SelectionForeground" Value="{StaticResource InputSelectionForegroundBrush}" />-->
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="PasswordBox">
                    <Grid x:Name="RootElement">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal" />
                                <VisualState x:Name="MouseOver" />
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0" To="0.55" Storyboard.TargetProperty="Opacity"
                                                Storyboard.TargetName="DisabledVisualElement" />
                                        <DoubleAnimation Duration="0" To="0.5"
                                                Storyboard.TargetProperty="(UIElement.Opacity)"
                                                Storyboard.TargetName="PART_ContentHost" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="ReadOnly">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0" To="0.55" Storyboard.TargetProperty="Opacity"
                                                Storyboard.TargetName="ReadOnlyVisualElement" />
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="FocusStates">
                                <VisualState x:Name="Focused">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0" Storyboard.TargetName="FocusVisualElement"
                                                Storyboard.TargetProperty="(FrameworkElement.Opacity)" To="1" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Unfocused" />
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="ValidationStates">
                                <VisualState x:Name="Valid" />
                                <VisualState x:Name="InvalidUnfocused">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility"
                                                Storyboard.TargetName="ValidationErrorElement">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Visible}" />
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="InvalidFocused">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility"
                                                Storyboard.TargetName="ValidationErrorElement">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Visible}" />
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="IsOpen"
                                                Storyboard.TargetName="validationTooltip">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <System:Boolean>True</System:Boolean>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Border x:Name="Border" Background="{TemplateBinding Background}"
                                BorderBrush="{TemplateBinding BorderBrush}"
                                BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="2.5" Opacity="1">
                            <Grid>
                                <Border x:Name="ReadOnlyVisualElement" Background="{StaticResource DarkDisabledBrush}"
                                        CornerRadius="2" Opacity="0" />
                                <ScrollViewer x:Name="PART_ContentHost" Foreground="{TemplateBinding Foreground}"
                                        Padding="{TemplateBinding Padding}" />

                            </Grid>
                        </Border>
                        <Border x:Name="DarkEdge" BorderBrush="{StaticResource ControlDarkEdge}"
                                BorderThickness="1,1,0,0" CornerRadius="2.5" Margin="0" />
                        <Border x:Name="OuterHighlight" BorderBrush="{StaticResource ControlOuterHighlightBrush}"
                                BorderThickness="0,0,1,1" CornerRadius="3" Margin="0,0,-1,-1" />
                        <Border x:Name="InnerShadowDark" BorderBrush="{StaticResource DarkInnerShadowDarkBrush}"
                                BorderThickness="1,1,0,0" CornerRadius="2" Margin="1" />
                        <Border x:Name="InnerShadowLight" BorderBrush="{StaticResource DarkInnerShadowLightBrush}"
                                BorderThickness="1,1,0,0" CornerRadius="1" Margin="2" />
                        <Border x:Name="DisabledVisualElement" Background="{StaticResource DarkDisabledBrush}"
                                IsHitTestVisible="False" Margin="1" Opacity="0" CornerRadius="2" />
                        <Rectangle x:Name="FocusVisualElement" IsHitTestVisible="False" Margin="2" Opacity="0"
                                RadiusX="1" RadiusY="1" Stroke="{StaticResource FocusVisualBrush}"
                                StrokeThickness="{StaticResource FocusVisualStrokeThickness}" />
                        <Border x:Name="ValidationErrorElement" BorderBrush="{StaticResource ErrorBrush}"
                                BorderThickness="1" CornerRadius="3" Visibility="Collapsed">
                            <ToolTipService.ToolTip>
                                <ToolTip x:Name="validationTooltip"
                                        DataContext="{Binding RelativeSource={RelativeSource TemplatedParent}}"
                                        Placement="Right"
                                        PlacementTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}"
                                        Template="{StaticResource ValidationToolTipTemplate}">
                                    <ToolTip.Triggers>
                                        <EventTrigger RoutedEvent="Canvas.Loaded">
                                            <BeginStoryboard>
                                                <Storyboard>
                                                    <ObjectAnimationUsingKeyFrames
                                                            Storyboard.TargetProperty="IsHitTestVisible"
                                                            Storyboard.TargetName="validationTooltip">
                                                        <DiscreteObjectKeyFrame KeyTime="0" Value="True" />
                                                    </ObjectAnimationUsingKeyFrames>
                                                </Storyboard>
                                            </BeginStoryboard>
                                        </EventTrigger>
                                    </ToolTip.Triggers>
                                </ToolTip>
                            </ToolTipService.ToolTip>
                            <Grid Background="Transparent" HorizontalAlignment="Right" Height="12" Margin="1,-4,-4,0"
                                    VerticalAlignment="Top" Width="12">
                                <Path Data="M 1,0 L6,0 A 2,2 90 0 1 8,2 L8,7 z" Fill="{StaticResource ErrorBrush}"
                                        Margin="1,3,0,0" />
                            </Grid>
                        </Border>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- Text Styles. -->
    <Style TargetType="TextBlock" x:Key="TextBlockLight">

        <Setter Property="Foreground" Value="{StaticResource NormalFontBrush}" />
    </Style>


</ResourceDictionary>